Skip to content

Instantly share code, notes, and snippets.

@kristoferjoseph
kristoferjoseph / index.js
Last active August 29, 2015 13:57
Simplest livereload development server I could make
var express = require('express'),
instant = require('instant'),
colors = require('colors'),
app = express();
app.use(instant(__dirname));
app.listen(3000,
console.log('Navigate to ' + 'http://localhost:3000'.green + ' to view your page')
);
/*
I used your style, your header div, but with a slide like this
<section data-state="showHeader" data-header="custom head">
<p>Hello</p>
</section>
*/
Reveal.addEventListener( 'slidechanged', function( event ) {
@Integralist
Integralist / detect.js
Created October 23, 2012 12:05
Detect CSS Animation support and provide object of normalised properties
function CSSAnimation(){
/*
webkitAnimationName => Safari/Chrome
MozAnimationName => Mozilla Firefox
OAnimationName => Opera
animationName => compliant browsers (inc. IE10)
*/
var supported = false;
var prefixes = ['webkit', 'Moz', 'O', ''];
var limit = prefixes.length;
@oslego
oslego / noquery.js
Created October 31, 2012 22:42
Small jquery-like experiment
var $ = function(){
function noQuery() {
var args = Array.prototype.slice.call(arguments, 0)[0],
query = args[0]
qsa = function(q){
return Array.prototype.slice.call(document.querySelectorAll(q), 0)
}
this.el = []
@oslego
oslego / jQuery Custom Events Bubble.js
Created December 11, 2010 19:57
Custom jQuery events triggered on non-DOM elements that bubble (propagate) up to the 'document'
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
(function($){
//non-DOM object events that propagate up to the 'document'
@events =
events: {}
on: (topic, handler, context = this) ->
(@events[topic] or= []).push {handler, context}
trigger: (topic, args...) ->
return unless @events[topic]?
handler.apply(context, args) for {handler, context} in @events[topic]
@kpdecker
kpdecker / nodebf.md
Last active June 2, 2016 18:02
mobile.walmart.com #nodebf 2014

Mobile Server Side Rendering

This year marks the first year that we are doing full scale rendering of our SPA application on our mobile.walmart.com Node.js tier, which has provided a number of challenges that are very different from the mostly IO-bound load of our prior #nodebf.

The infrastructure outlined for last year is the same but our Home, Item and a few other pages are prerendered on the server using fruit-loops and hula-hoop to execute an optimized version of our client-side JavaScript and provide a SEO and first-load friendly version of the site.

To support the additional CPU load concerns as peak, which we hope will be unfounded or mitigated by our work, we have also taken a variety of steps to increase cache lifetimes of the pages that are being served in this manner. In order of their impact:

Event Loop Management

Confusing Components

Do I need all four parts?

  • Custom Elements
  • Shadow DOM
  • HTML Imports
  • HTML Templates

I'm confused as to which bits I need supported. Do I need all of them to blindy create and use other components?

@streunerlein
streunerlein / gist:3332181
Created August 12, 2012 14:58
NPM Mirrors & Proxies

Definition

Mirrors: standalone servers with complete copy of npm registry

Proxies: proxy to the database (couchdb) of npm registry, if only the npm registry server fails but the db works

## HowTo See this gist: https://gist.github.com/3331671

Mirrors

(+) means server is self updating (pulls newest stuff from offical registry when back online again)

@jlongster
jlongster / gist:1288142
Created October 14, 2011 20:00
Bugzilla jsonrpc
function jsonrpc(user, method, params, http_method, cont) {
if(_.isFunction(http_method)) {
cont = http_method;
http_method = 'GET';
}
var request;
var opts = {