Skip to content

Instantly share code, notes, and snippets.

@natos
natos / nodejs
Last active August 29, 2015 14:08
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"
@natos
natos / jquery.imagesloaded.js
Created June 10, 2011 21:09 — forked from desandro/jquery.imagesloaded.js
$.fn.imagesLoaded jQuery plugin
// $('#content-with-images').imagesLoaded( myFunction )
// execute a callback when all images inside a parent have loaded.
// needed because .load() doesn't work on cached images
// Useful for Masonry or Isotope, triggering dynamic layout
// after images have loaded:
// $('#content').imagesLoaded( function(){
// $('#content').masonry();
// });
@natos
natos / uniq.js
Created October 6, 2011 11:08
Eliminate duplicates from an Array
var uniq = function (arr) {
var i,
len=arr.length,
out=[],
obj={};
for (i=0; i<len; i++) {
obj[arr[i]]=0;
@natos
natos / prettyDate.js
Created October 19, 2011 10:56
PrettyDate.js from John Resig
/*
* JavaScript Pretty Date (http://ejohn.org/files/pretty.js)
* Copyright (c) 2011 John Resig (ejohn.org)
* Licensed under the MIT and GPL licenses.
* Modified by Natan Santolo.
*/
// Takes an ISO time and returns a string representing how
// long ago the date represents.
function prettyDate(time){
@natos
natos / dabblet.css
Created May 2, 2012 16:02
Scrolling shadows by @kizmarh
/* Scrolling shadows by @kizmarh */
html {
background: #FFF;
}
.scrollbox {
position: relative;
z-index: 1;
@natos
natos / rAF.js
Created July 30, 2012 11:11 — forked from paulirish/rAF.js
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
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
$(function() {
// Depends on: jQuery, jQuery UI core & widgets (for the autocomplete method)
// Assumes you're already including the FB JS SDK asynchronously...
window.fbAsyncInit = function() {
FB.init({
appId : 'xxxxxxxxxxxxxxxxxx', // App ID
status : true, // check login status
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
// early experiments with node had mysterious double requests
// turned out these were for the stoopid favicon
// here's how to short-circuit those requests
// and stop seeing 404 errors in your client console
var http = require('http');
http.createServer(function (q, r) {
// control for favicon