Skip to content

Instantly share code, notes, and snippets.

View 0gust1's full-sized avatar
🔥

Augustin C. 0gust1

🔥
View GitHub Profile
@metafeather
metafeather / POJOToJSON.mv
Created November 7, 2012 15:26 — forked from narenranjit/VelToJSON
Macros to convert Plain Old Java Objects in Velocity templates to JSON
#macro(POJOListToJSON $list )
#set($myList = $list )
{
#foreach($key in $myList.keySet())
#set($x = $myList.get($key))
"$key": #POJOToJSON($x) ##
#if($velocityCount != $myList.keySet().size())
,
#end
#end
@0gust1
0gust1 / IERenderingModes.js
Created April 25, 2012 13:55
Javascript bookmarklet displaying all important Internet Explorer rendering informations
javascript:(function(){
var txtAlert='';
txtAlert+='Browser : '+window.navigator.appName+' '+window.navigator.appVersion+'\nUser-Agent : '+window.navigator.userAgent+'\nDocumentMode : '+document.documentMode+'\nCompatMode : '+document.compatMode;
//console.log(txtAlert);
alert(txtAlert);
})()
@domenic
domenic / README.md
Created March 29, 2012 16:01
Cross-platform git hooks for Node.js

Here's how this works:

  • Include a git_hooks/ directory in your project, with these two files (plus other hooks if you want, written in a similar style).
  • Add "npm" to your devDependencies in package.json, so that the pre-commit hook can do its magic.
  • Add test and lint scripts to your package.json, e.g.
    "scripts": {
        "test": "mocha",
 "lint": "jshint ./lib --show-non-errors"
@scottjehl
scottjehl / getViewportSize.js
Created March 16, 2012 19:25
Reliably get viewport dimensions in JS
/*!
An experiment in getting accurate visible viewport dimensions across devices
(c) 2012 Scott Jehl.
MIT/GPLv2 Licence
*/
function viewportSize(){
var test = document.createElement( "div" );
test.style.cssText = "position: fixed;top: 0;left: 0;bottom: 0;right: 0;";
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@banksean
banksean / mersenne-twister.js
Created February 10, 2010 16:24
a Mersenne Twister implementation in javascript. Makes up for Math.random() not letting you specify a seed value.
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();