Skip to content

Instantly share code, notes, and snippets.

View ifyouseewendy's full-sized avatar

Di Wen ifyouseewendy

View GitHub Profile
@kepano
kepano / obsidian-web-clipper.js
Last active April 28, 2025 07:22
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/[email protected]?module'), import('https://unpkg.com/@tehshrike/[email protected]'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@jonhoo
jonhoo / cell-tests.rs
Last active November 14, 2024 08:42
cell-refcell-rc
// these aren't _quite_ functional tests,
// and should all be compile_fail,
// but may be illustrative
#[test]
fn concurrent_set() {
use std::sync::Arc;
let x = Arc::new(Cell::new(42));
let x1 = Arc::clone(&x);
std::thread::spawn(move || {
@djensenius
djensenius / git_new_push.fish
Created February 14, 2020 15:35
Fish shortcut function to simplify git --set-upstream
function git_new_push --description 'Shortcut to push new branch'
if not command -sq git
return 1
end
set -l repo_info (command git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree HEAD 2>/dev/null)
test -n "$repo_info"
or return
set -l rbc (__fish_git_prompt_operation_branch_bare $repo_info)
set -l b $rbc[2]
@s-macke
s-macke / hello.c
Last active September 21, 2024 12:08
Hello world example by using an headerless implementation of the WASI interface version 0.1 . The only dependency is clang.
/*
* This code is a headerless implementation of the WASI interface version 0.1 in C and prints "Hello World!.
* You only need clang.
*
* compile with
* clang -Os -nostdlib --target=wasm32 hello.c -o hello.wasm
*
* run with
* https://runno.dev/wasi
* Just upload hello.wasm
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active April 28, 2025 16:22
Vanilla JavaScript Quick Reference / Cheatsheet
@olih
olih / jq-cheetsheet.md
Last active May 10, 2025 20:55
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@maxivak
maxivak / 00.md
Last active April 8, 2025 18:31
Sending emails with ActionMailer and Sidekiq

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create your mailer us usual:

@Geesu
Geesu / assets.rake
Created December 8, 2014 16:55
Disable asset precompilation on heroku
Rake::Task["assets:precompile"].clear
namespace :assets do
task 'precompile' do
puts "Not pre-compiling assets..."
end
end
# Using these pry gems -- copy to your Gemfile
# group :development, :test do
# gem 'awesome_print' # pretty print ruby objects
# gem 'pry' # Console with powerful introspection capabilities
# gem 'pry-byebug' # Integrates pry with byebug
# gem 'pry-doc' # Provide MRI Core documentation
# gem 'pry-rails' # Causes rails console to open pry. `DISABLE_PRY_RAILS=1 rails c` can still open with IRB
# gem 'pry-rescue' # Start a pry session whenever something goes wrong.
# gem 'pry-theme' # An easy way to customize Pry colors via theme files
# end
@jsteiner
jsteiner / database_cleaner.rb
Created January 10, 2014 20:31
Database Cleaner
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do