Skip to content

Instantly share code, notes, and snippets.

View geowarin's full-sized avatar

Geoffroy Warin geowarin

View GitHub Profile
@maxbrunsfeld
maxbrunsfeld / backbone_super.js
Created December 30, 2011 23:58
A 'super' method for backbone.js (plain javascript)
// This method gives you an easier way of calling super
// when you're using Backbone in plain javascript.
// It lets you avoid writing the constructor's name multiple
// times. You still have to specify the name of the method.
//
// So instead of having to write:
//
// User = Backbone.Model.extend({
// save: function(attrs) {
// this.beforeSave(attrs);
@paulirish
paulirish / rAF.js
Last active April 17, 2025 15:06
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@mojavelinux
mojavelinux / examples.md
Last active September 3, 2020 17:04
Menu and key macros for AsciiDoc

Examples of custom macros for AsciiDoc

Path

path:/home/dallen/[]
path:/etc/my.cnf[]

Key

key:Enter[]

@raymyers
raymyers / EmbeddedJetty9Server.java
Created April 5, 2013 22:47
Embedded server with Jetty 9, including filelock workaround.
package com.cadrlife;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
public class EmbeddedJetty9Server {
// compile 'org.eclipse.jetty:jetty-server:9.0.0.v20130308'
// compile 'org.eclipse.jetty:jetty-webapp:9.0.0.v20130308'
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
@bbbco
bbbco / Generic Highlight
Created July 16, 2013 14:37
Selenium WebDriver // Highlights the element object in a yellow border
driver.executeScript("arguments[0].setAttribute(arguments[1], arguments[2])", element, "style", "border: 2px solid yellow; color: yellow; font-weight: bold;")
# INSTALL AND CONFIGURE BEES SDK
export BEES_HOME=/opt/cloudbees/cloudbees-sdk/
export PATH=$PATH:$BEES_HOME
if [ ! -d ~/.bees ]; then
bees init -f -a <account name> -ep us -k $BEES_API -s $BEES_SECRET
fi
bees plugin:install com.cloudbees.sdk.plugins:bg-plugin
# DEPLOY
@jbenet
jbenet / simple-git-branching-model.md
Last active May 3, 2025 18:07
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
[*.java]
insert_final_newline = true
@videlais
videlais / Gamepad.js
Last active July 17, 2021 09:36
Complete Gamepad.js code
/**
* (Note: Depends on window.requestAnimationFrame for polling.)
*
* An experimental Gamepad object for detecting
* and parsing gamepad input.
*
* Current code borrows heavily from Marcin Wichary's work:
* http://www.html5rocks.com/en/tutorials/doodles/gamepad/
*
* Also uses deadzone values from