Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@funny-falcon
funny-falcon / changes.md
Last active March 23, 2024 05:53
Performace patch for ruby-1.9.3-p327

Changes:

  • this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .

    ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.

  • this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.

    This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.

#!/usr/bin/env node
import { chromium } from "playwright";
import { readFileSync } from "node:fs";
import { once } from "node:events";
async function main() {
const browser = await chromium.launch({ headless: false });
try {
const cookies = await readCookies("cookies.json");
@krisselden
krisselden / profile.js
Created February 19, 2021 01:09
Profile node with child processes
/* eslint-env node */
const { Session } = require('inspector');
const fs = require('fs');
const captureExit = require('capture-exit');
captureExit.captureExit();
/** @param exitPromise {Promise<void>} */
async function runProfile(exitPromise) {
@bsingr
bsingr / ruby_ipv4_notations.rb
Created November 1, 2011 11:19
Convert Ipv4 Addresses between Integer and dot-decimal notation using ruby
# How to convert IPv4 addresses between integer <=> dot-decimal notation
INTEGER = 1698212032
DOT_DECIMAL = '192.168.56.101'
# [ 192, 168, 56, 101 ]
DOT_DECIMAL_PARTS = DOT_DECIMAL.split('.').map(&:to_i)
####################################
# integer to dot-decimal
@victorporof
victorporof / async-stack-tagging-non-recurring.js
Last active May 30, 2022 06:25
Async Stack Tagging API (Non-Recurring)
/* --- Userland --- */
function someTask() {
console.trace("completeWork: someTask");
}
function someOtherTask() {
console.trace("completeWork: someOtherTask");
}
@victorporof
victorporof / async-stack-tagging-recurring.js
Last active May 30, 2022 06:25
Async Stack Tagging API (Recurring)
/* --- Userland --- */
function makeUpdate(i) {
return function someUpdate() {
console.trace(`completeUpdate: update ${i}`);
};
}
function businessLogic() {
scheduler.scheduleTask("foo", [makeUpdate(1), makeUpdate(2), makeUpdate(3)]);
@peterc
peterc / dnsd.rb
Created December 2, 2011 23:47
Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
#
# MIT license
#
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance
# * All records get the same TTL