Skip to content

Instantly share code, notes, and snippets.

@solenoid
solenoid / gist:1372386
Created November 17, 2011 04:49
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@smeranda
smeranda / facebook_like-box_responsive.css
Created May 1, 2012 20:37
Flexible width layout for Facebook Like Box/Activity Stream to use in Responsive Designs
/*
Make the Facebook Like box responsive (fluid width)
https://developers.facebook.com/docs/reference/plugins/like-box/
*/
/* This element holds injected scripts inside iframes that in some cases may stretch layouts. So, we're just hiding it. */
#fb-root {
display: none;
}
@IanVaughan
IanVaughan / README.md
Created June 7, 2012 09:57
Push branch from one remote into another

Push branch from one remote into another

Add remote2 as a remote

$ git remote -v
remote2 git@github.com:repo2.git (fetch)
remote2 git@github.com:repo2.git (push)
origin  git@github.com:repo.git (fetch)
origin  git@github.com:repo.git (push)
@caniszczyk
caniszczyk / clone-all-twitter-github-repos.sh
Created October 9, 2012 04:25
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@mwunsch
mwunsch / emoji_image_replace.js
Last active August 13, 2023 21:44
Detect emoji unicode on a page, replace it with images (supplied by GitHub, for now). Goes great in your ~/.js
/**
*
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
*
* Much of this code was gleaned from staring at the minified GitHub JS.
*
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
@jaredhirsch
jaredhirsch / gist:4963424
Last active March 19, 2021 08:54
ETags & If-None-Match headers: a dialogue

ETags & If-None-Match headers: a dialogue

1st request.

browser: can haz foo?

GET /foo HTTP/1.1

1st response.

@rxaviers
rxaviers / gist:7360908
Last active April 24, 2024 18:49
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@danharper
danharper / background.js
Last active March 30, 2024 18:25
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
/**
* User Timing polyfill (http://www.w3.org/TR/user-timing/)
* @author RubaXa <trash@rubaxa.org>
*/
(function (window){
var
startOffset = Date.now ? Date.now() : +(new Date)
, performance = window.performance || {}
, _entries = []
@cam8001
cam8001 / dapply
Last active December 20, 2023 19:40
Apply a patch directly from a URL without downloading it first.
#!/bin/bash
# Downloads and applies a patch from Drupal.org.
if [ -z "$1" ]
then
echo "You need to supply a URL to a patch file."
exit
fi
URL=$1;