Skip to content

Instantly share code, notes, and snippets.

View jgatjens's full-sized avatar
🏠
working from home!

Jairo Gätjens jgatjens

🏠
working from home!
View GitHub Profile
@jgatjens
jgatjens / Module no dependencies
Created May 24, 2013 15:18
No dependencies? Object literal? No problem!
define({
forceChoke: function() {
},
forceLighting: function() {
},
forceRun: function() {
}
@jgatjens
jgatjens / gist:5145268
Created March 12, 2013 17:59
Nodejs - Static File Server
var express = require(' express');
var app = express();
app.configure(function() {
app.set(' view engine', 'jade');
app.use(express.static(__dirname + '/ public'));
});
app.get('/', function(req, res) {
res.render(" index.jade", {
layout: false
});
@jgatjens
jgatjens / script.js
Created March 11, 2013 16:44
Mongodb - script collection multiples query
var conn = new Mongo();
var db = conn.getDB("test");
var myCursor = db.images.find();
myCursor.forEach(
function(myDoc) {
// print( "images: " + tojson(myDoc) );
var myAlbum = db.albums.findOne( { "images": myDoc._id } );
@jgatjens
jgatjens / class.js
Created February 23, 2013 04:47 — forked from mcgrew/class.js
/* Simple JavaScript Inheritance
* By John Resig http://ejohn.org/
* MIT Licensed.
* Usage exmaples: http://ejohn.org/blog/simple-javascript-inheritance/
*/
// Inspired by base2 and Prototype
(function(){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing)
this.Class = function(){};
@jgatjens
jgatjens / sprite-example.scss
Last active December 13, 2015 18:18
Compass - Custom sprite
@import "compass/utilities/sprites/base";
$icons: sprite-map("images/icons/*.png", $layout: smart);
[class^="icon-"] {
display: inline-block;
background: $icons;
}
@each $i in sprite_names($icons) {
@jgatjens
jgatjens / gist:4601347
Created January 23, 2013 02:33
Regular Expresion - mark tag text
(?<=<h2>).+(?=</h2>)