Skip to content

Instantly share code, notes, and snippets.

Avatar

Stefano Ortisi stefanoortisi

View GitHub Profile
View gist:845285adf750f464d7de
### Keybase proof
I hereby claim:
* I am stefanoortisi on github.
* I am ortisi (https://keybase.io/ortisi) on keybase.
* I have a public key whose fingerprint is 4FE9 7C3C BA96 125E 2D1A 0681 2BC5 8974 F5CB 29CE
To claim this, I am signing this object:
View log
// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
log.history = log.history || []; // store logs to an array for reference
log.history.push(arguments);
arguments.callee = arguments.callee.caller;
if(this.console) console.log( Array.prototype.slice.call(arguments) );
};
View socket.io.test.coffee
fs = require("fs")
http = require("http")
socketio = require("socket.io")
public_path = "#{__dirname}/../public"
server = http.createServer((req, res) ->
res.writeHead 200, "Content-type": "text/html"
res.end fs.readFileSync "#{public_path}/index.html"
).listen(8765)
View localise_route
localise_routes: ( ) ->
# Deep clone the default routes
old_routes = _.cloneDeep @Routes.routes
# Create a brand new routes object
@Routes.routes = {}
# Copy the utility routes
@Routes.routes[ "/pages" ] = old_routes[ "/pages" ]
View jquery.imagesloaded.js
// $('img.photo',this).imagesLoaded(myFunction)
// execute a callback when all images have loaded.
// needed because .load() doesn't work on cached images
// Modified with a two-pass approach to changing image
// src. First, the proxy imagedata is set, which leads
// to the first callback being triggered, which resets
// imagedata to the original src, which fires the final,
// user defined callback.
View mixin.styl
border-radius(n)
-webkit-border-radius n
-moz-border-radius n
border-radius n
// Math
// ------------------------------
floor(n){math(n, 'floor')}
@stefanoortisi
stefanoortisi / tweener.coffee
Last active Dec 21, 2015
Tweener Coffescript Class
View tweener.coffee
###
An utility object which allows to create different animations with different keyframes.
The get_value method return the interpolated value of the selected animation depending on time parameter.
###
class Tweener
constructor: ->
@keyframes = new Object()
@stefanoortisi
stefanoortisi / Revert
Created Jun 13, 2013
Revert a branch to a previous commit
View Revert
# To revert to a commit further back than the most recent commit--------
git reset 56e05fced #resets index to former commit; replace '56e05fced' with your commit code
git reset --soft HEAD@{1} #moves pointer back to previous HEAD
git commit -m "Revert to 56e05fced"
git reset --hard #updates working copy to reflect the new commit