Skip to content

Instantly share code, notes, and snippets.

@arantius
arantius / authors-karma-blocker-rules.ini
Last active March 22, 2017 18:16
The Karma Blocker rules used by the author
# See: https://github.com/arantius/karma-blocker/wiki/Configuration
[Settings]
threshold=12
cutoff=18
collapse=false
[Group]
name="Personal sites whitelist"
score=-12
rule=$origin.host=='localhost'
@katta
katta / gitdiff-svnpatch.sh
Created June 16, 2011 08:10
Converts git diff to svn patch format
git diff --no-prefix | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" --ignore-space-at-eol > changes.patch
@Rob-ot
Rob-ot / Draggable.js
Created December 16, 2011 23:46
Draggable and dropable views for backbone, uses html5 drag and drop api, requires jquery and underscore, not tested in IE yet
return View.extend({
initialize: function () {
this.el.attr("draggable", "true")
this.el.bind("dragstart", _.bind(this._dragStartEvent, this))
},
_dragStartEvent: function (e) {
var data
if (e.originalEvent) e = e.originalEvent
e.dataTransfer.effectAllowed = "copy" // default to copy
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@markjaquith
markjaquith / gist:2653957
Created May 10, 2012 15:36
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
@lewg
lewg / wp-config-batcache.php
Created September 12, 2012 18:40
WordPress config for batcache + wptouch
<?php
/* Custom Config for Batcache */
// Determine if this is a WP Touch User Agent
function is_wptouch_user_agent() {
// This needs to match your WP Touch list!!
$useragents = array(
// Apple iOS/Webkit
"iphone", "ipod", "incognito", "webmate",
// Android OS
@murtaugh
murtaugh / 1. single-line.html
Last active April 21, 2021 16:23
Blockquote patterns for ALA
<figure class="quote">
<blockquote>It is the unofficial force—the Baker Street irregulars.</blockquote>
</figure>
@markjaquith
markjaquith / wp-smart-cache.php
Created February 6, 2013 22:59
WordPress Object Cache wrapper I'm working on that has support for group purging.
<?php
if ( !class_exists( 'WP_Smart_Cache_v1' ) ) :
Class WP_Smart_Cache_v1 {
static $instances = array();
public function __construct() {
if ( function_exists( 'wp_cache_add_global_groups' ) )
wp_cache_add_global_groups( array( 'wp_smart_cache_global' ) );
}
@atenni
atenni / README.md
Last active July 20, 2024 05:49
How to permalink to a gist's raw file

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]