Skip to content

Instantly share code, notes, and snippets.

@kujon
kujon / samplerest.js
Last active August 27, 2015 22:24 — forked from joshbirk/samplerest.js
Sample of using passport w/ mult strategies
var fs = require("fs")
var ssl_options = {
key: fs.readFileSync('privatekey.pem'),
cert: fs.readFileSync('certificate.pem')
};
var port = process.env.PORT || 3000;
var express = require('express');
var ejs = require('ejs');
var passport = require('passport')
@kujon
kujon / blud.js
Created July 10, 2015 16:52
Brototype plugin for London-based developers
var Blud = Bro;
Blud.NANG = Bro.TOTALLY;
Blud.DRED = Bro.NOWAY;
var methods = {
// Blud(blud1).manz('sket')
manz: Bro.prototype.doYouEven,
// Blud(blud1).dash('puff')
dash: Bro.prototype.iCanHaz,
@kujon
kujon / starter.coffee
Created March 7, 2012 23:43
CoffeeScript: jQuery starting template
(($) ->
$ ->
)(jQuery)
@kujon
kujon / placeholder.js
Created March 7, 2012 23:45 — forked from athanassiadis/Modernizr placeholder
JavaScript: Modernizr placeholder
if (!Modernizr.input.placeholder) {
$('[placeholder]').each(function() {
var $self = $(this);
$self.val($self.attr('placeholder'));
$self.focus(function() {
$self.val('');
}).blur(function() {
if($self.val().length < 1) {
@kujon
kujon / modernizr-tests.js
Created March 8, 2012 00:04 — forked from danott/modernizr-tests.js
JavaScript: Custom Modernizr tests that are useful.
/* modernizr-test.js
* Daniel Ott
* 3 March 2011
* Custom Tests using Modernizr's addTest API
*/
/* iOS
* There may be times when we need a quick way to reference whether iOS is in play or not.
* While a primative means, will be helpful for that.
*/
@kujon
kujon / modernizr.css
Created March 8, 2012 00:06 — forked from qwertypants/modernizr.css
CSS: Generic structure for Modernizr CSS styles
.js {}
.no-js {}
.flexbox {}
.no-flexbox {}
.canvas {}
.no-canvas {}
.canvastext {}
.no-canvastext {}
.webgl {}
.no-webgl {}
@kujon
kujon / selector.js
Created March 8, 2012 11:04
JavaScript: Defining selector
$.extend(
$.expr[ ":" ],
{ selector : function (a) { return test; }}
);
@kujon
kujon / rAF.js
Created March 15, 2012 14:21 — forked from paulirish/rAF.js
JavaScript: 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) {
@kujon
kujon / Asset.css
Created March 15, 2012 14:30 — forked from jCrip/Asset.css
CSS: Media Queries Bootstrap
// Landscape phones and down
@media (max-width: 480px) { ... }
// Landscape phone to portrait tablet
@media (max-width: 767px) { ... }
// Portrait tablet to landscape and desktop
@media (min-width: 768px) and (max-width: 979px) { ... }
// Large desktop
@kujon
kujon / Asset.js
Created March 15, 2012 15:23 — forked from jCrip/Asset.html
JavaScript: Viewport Scaling Bug
(function(doc) {
var addEvent = 'addEventListener',
type = 'gesturestart',
qsa = 'querySelectorAll',
scales = [1, 1],
meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
function fix() {
meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];