Skip to content

Instantly share code, notes, and snippets.

View shaal's full-sized avatar

Ofer Shaal shaal

View GitHub Profile
@tomsiwik
tomsiwik / README.md
Last active May 6, 2025 23:44
How to proxy Cursor → OpenAPI → Python → Ollama

Make sure you run ollama serve (this is OpenAI-compatible http://localhost:11434)

Open cursor model settings and specify:

  • Specify http://localhost:8000/v1
  • Hit "Save" (no need to activate key)
  • Select gpt-4o and enjoy local model
uv venv
@KonnorRogers
KonnorRogers / my-element.ts
Last active July 16, 2024 16:17
Catching hydration errors in Lit
class MyElement extends LitElement {
protected update(changedProperties: PropertyValues<this>): void {
try {
super.update(changedProperties)
} catch (e) {
// We should probably check the contents of the message since this could error on a regular update??
// I really dont know. Its hacky, but it works.
const event = new Event("lit-hydration-error", { bubbles: true, composed: true, cancelable: false })
// @ts-expect-error leave me alone TS.
event.error = e
@shaal
shaal / cursor.sh
Created July 11, 2024 14:34 — forked from ddwang/cursor.sh
Replace `/mnt/c/Users/<USER_NAME>/AppData/Local/Programs/cursor/resources/app/bin/cursor`
#!/usr/bin/env sh
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
if [ "$VSCODE_WSL_DEBUG_INFO" = true ]; then
set -x
fi
COMMIT="abd2f3db4bdb28f9e95536dfa84d8479f1eb312d"
APP_NAME="code"
@ddwang
ddwang / cursor.sh
Last active December 9, 2024 00:24
Replace `/mnt/c/Users/<USER_NAME>/AppData/Local/Programs/cursor/resources/app/bin/cursor`
#!/usr/bin/env sh
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
if [ "$VSCODE_WSL_DEBUG_INFO" = true ]; then
set -x
fi
COMMIT="abd2f3db4bdb28f9e95536dfa84d8479f1eb312d"
APP_NAME="code"
#!/bin/bash -e
# Generates a detached tmate session, perfect to debug pipelines in-line
tmate -S /tmp/tmate.sock new-session -d
tmate -S /tmp/tmate.sock wait tmate-ready
tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}'
tmate -S /tmp/tmate.sock wait-for new-session
@bbenjamin
bbenjamin / drupalJqueryRemoval.md
Last active February 7, 2023 13:21
Issues relevant to Drupal JavaScript modernization and jQuery removal

Presentation Slides

https://docs.google.com/presentation/d/17Zpy5fZQsWsoZBhisA3rQiZy_JrK9MPR_HdgAisQ9XI/edit?usp=sharing

jQuery UI

@tsega
tsega / d9_porting_weekend_setup.md
Last active November 19, 2024 15:40
How to contribute to Drupal 9 Porting Weekend

How to prepare for Drupal 9 Porting Weekend

If you haven't heard about it, there is an important event scheduled for May 22 & 23, 2020 to do mass porting of Drupal 8 modules and themes to Drupal 9.

The following a set of instructions will show you how to contribute to that effort.

For a more detailed detailed account please see Kristen Pol's blog post, Preparing yourself for Drupal 9 porting weekend.

1. Install Drupal 8 + Helper Modules

  1. First thing to do, of course, is to install Drupal 8 - the recommended way is to use composer. For alternative setups, see @mradcliffe comment below.
@nikathone
nikathone / RecurringOrderManager.php
Last active November 21, 2019 22:15
Customization for revoking a subscription/Commerce recurring
<?php
namespace Drupal\custom_commerce_recurring;
use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\commerce_recurring\RecurringOrderManager as BaseRecurringOrderManager;
use Drupal\commerce_recurring\RecurringOrderManagerInterface;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
@startinggravity
startinggravity / lando-emulsify.md
Last active October 29, 2019 01:50
Using Lando with Emulsify

I have had a few requests for more information about using Lando with Drupal 8, the Emulsify theme and Gulp. In order to put what I've learned in one place, I'm adding my notes here.

My initial problem was reported here, but since then I have discovered a few additional things worth noting.

Once you have a working site on Lando and are ready to install Emulsify use the following directions instead of what has provided by the Emulsify developers. These instructions assume you have used Composer to install Drupal and that the root Drupal files are in the /web directory.


NOTE: To follow these instructions, you will need to run NPM commands from your host machine, which means you must have Node and NPM installed. Fortunately, they are installed together in one installation. If you wish to confirm you have them installed, run node -v and npm -v. To install, visit nodejs.org and follow the i

@shaal
shaal / colliding.js
Created August 7, 2017 14:38 — forked from jtsternberg/colliding.js
Detect if two elements are colliding/overlapping
/**
* Detects if two elements are colliding
*
* Credit goes to BC on Stack Overflow, cleaned up a little bit
*
* @link http://stackoverflow.com/questions/5419134/how-to-detect-if-two-divs-touch-with-jquery
* @param $div1
* @param $div2
* @returns {boolean}
*/