Skip to content

Instantly share code, notes, and snippets.

View geowarin's full-sized avatar

Geoffroy Warin geowarin

View GitHub Profile
@parasyte
parasyte / jay-inheritance.js
Last active July 3, 2019 19:55
Jay inheritance : A *really fast* implementation of JavaScript single inheritance with mixins and a little syntactic sugar to make it go down smoothly. http://blog.kodewerx.org/2014/03/melonjs-should-be-all-about-speed.html || DEPRECATED, See: https://github.com/parasyte/jay-extend
/*
* Copyright (c) 2014, Jay Oster
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
@varunkumar
varunkumar / JS gsub
Created January 23, 2014 03:48
JavaScript implementaion of ruby's gsub
gsub = function(source, pattern, replacement) {
var match, result;
if (!((pattern != null) && (replacement != null))) {
return source;
}
result = '';
while (source.length > 0) {
if ((match = source.match(pattern))) {
result += source.slice(0, match.index);
result += (typeof replacement === 'function') ? replacement(match[0]) : replacement;
@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
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
[*.java]
insert_final_newline = true
@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.

# 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
@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;")
@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);
@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[]

@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