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:

@suzuki
suzuki / mail2.php
Created February 2, 2014 23:51
Swift Mailer sample / DKIM email
<?php
require 'vendor/autoload.php';
$transport = Swift_SmtpTransport::newInstance('localhost', 25);
$mailer = Swift_Mailer::newInstance($transport);
// DKIM 用の Signer を作成する
$privateKey = file_get_contents('./default.private');
$domainName = 'example.com';
@bionik
bionik / html5_video_convert.sh
Created January 22, 2015 13:44
Simple HTML5 video encoding bash script for OS X (Easily ported to Linux)
#!/bin/bash
set -e
# IMPORTANT! First install ffmpeg with encoders enabled, i.e. like this:
# brew install ffmpeg --with-libvpx --with-libvorbis --with-theora
# Will not re-encode files, if output file exists.
# Quality settings are configured in encoders' command line parameters below, sorry about that.
if [ -z "$1" ]; then
@eyecatchup
eyecatchup / apple-meta-insanity.html
Created February 8, 2015 12:28
Insanity of Apple-specific meta tags..
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Apple Meta Insanity</title>
<!--
APPLE WEB APP META TAGS
-->
@sdieunidou
sdieunidou / rabbitmq.txt
Created October 22, 2015 19:51
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@tcase360
tcase360 / debounce.js
Last active April 20, 2020 20:37
Debounce function in ES6
const debounce = (fn, time) => {
let timeout;
return function() {
const functionCall = () => fn.apply(this, arguments);
clearTimeout(timeout);
timeout = setTimeout(functionCall, time);
}
}