Skip to content

Instantly share code, notes, and snippets.

View prisme's full-sized avatar

Jérémy Saint-Prix prisme

View GitHub Profile
@mattdesl
mattdesl / app.js
Last active August 29, 2015 14:08
gsap-promise
var gallery = require('./page-gallery')
var popup = require('./info-popup')
gallery.show()
//once all elements in the page are done animating, do something else
.then(function() {
return popup.show()
})
@gordonnl
gordonnl / textToPages.js
Last active August 29, 2015 14:07
Return pages of text based on available space
/*
*
* Use:
* var textPages = textToPages(myElement)
* returns array of strings.
*
*/
var textToPages = function(element) {
var pages = [];
@nicoptere
nicoptere / lol()
Last active August 29, 2015 14:05
lol() : improving the console.log through dynamic LULZ injection
/**
* lol()
* improving the console.log through dynamic LULZ injection
*
* history
* - v0.0 RC - 2014-08-08 - 13h01 : initial release
* - v0.1 RC - 2014-08-08 - 13h29 : DogeScript support
*
* Licensed under WTFPL
*
@staltz
staltz / introrx.md
Last active July 31, 2025 06:33
The introduction to Reactive Programming you've been missing
@ruby0x1
ruby0x1 / tilt.shift.glsl
Last active November 5, 2024 10:54
Tilt shift shader, modified from something @grapefrukt gave me
// Modified version of a tilt shift shader from Martin Jonasson (http://grapefrukt.com/)
// Read http://notes.underscorediscovery.com/ for context on shaders and this file
// License : MIT
uniform sampler2D tex0;
varying vec2 tcoord;
varying vec4 color;
/*
Take note that blurring in a single pass (the two for loops below) is more expensive than separating
@mikaelbr
mikaelbr / destructuring.js
Last active February 20, 2025 13:00
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@branneman
branneman / better-nodejs-require-paths.md
Last active June 24, 2025 22:40
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@bloodyowl
bloodyowl / gist:5729489
Created June 7, 2013 14:05
js bitwise cheat sheet

js bitwise cheat sheet

var INIT = 0x1      // 0 0 0 0 1
  , PENDING = 0x2   // 0 0 0 1 0
  , DONE = 0x4      // 0 0 1 0 0
  , ERROR = 0x8     // 0 1 0 0 0
  , SUCCESS = 0x10  // 1 0 0 0 0
  , ALL = 0x1f      // 1 1 1 1 1
@kaneel
kaneel / resizeCollection.js
Last active December 16, 2015 19:49
resizeCollection, a tiny helper I've made so we can keep a trace of the resize events. Needs jQuery for its custom events + pub/sub model so you can have one resize event only that will trigger the resize-trigger inside resizeCollection.
;(function(root) {
/*
this module return methods for having resize collections bound to a timer;
use like this:
resizeCollection.register(function, ms)
If ms is null, will push the function to the 500ms timer.
If ms is given, will create a new resize timer.
*/
var lastTimer = 2000,
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory