This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/node | |
var quotes = [ | |
"Whatever you are, be a good one.\n-Abraham Lincoln", | |
"If you dream it, you can do it.\n-Walt Disney", | |
"Never, never, never give up.\n-Winston Churchill", | |
"Don’t wait. The time will never be just right.\n-Napoleon Hill", | |
"If not us, who? If not now, when?\n-John F. Kennedy", | |
"Everything you can imagine is real.\n-Pablo Picasso", | |
"I can, therefore I am.\n-Simone Weil", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
/** | |
example: | |
<ChatScroller ref="chatScroller"> | |
{this.renderStuff()} | |
</ChatScroller> | |
to force move the containt to the bottom: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.directive('dynamicHeight', function() { | |
return { | |
require: ['^ionSlideBox'], | |
link: function(scope, elem, attrs, slider) { | |
scope.$watch(function() { | |
return slider[0].__slider.selected(); | |
}, function(val) { | |
//getting the heigh of the container that has the height of the viewport | |
var newHeight = window.getComputedStyle(elem.parent()[0], null).getPropertyValue("height"); | |
if (newHeight) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//all of your express config stuff | |
var express = require('express') | |
, app = express() | |
//load api routes (app of the files from /api) | |
require('./api').boot(app) | |
//rest of your expressjs stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backbone.View = (function(View) { | |
// Define the new constructor | |
Backbone.View = function(attributes, options) { | |
// New constructor stuff here... | |
// Call default constructor | |
View.apply(this, arguments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Koajs example | |
var koa = require('koa'); | |
var app = koa(); | |
//Middleware cascading | |
app.use(function * (next) { | |
//Some stuff will happen here first | |
console.log('FIRST execution') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Paste image from clipboard in Chrome</title> | |
<script src="http://code.jquery.com/jquery-1.8.3.js"></script> | |
<script> | |
//plugin for pasting from https://gist.github.com/STRd6/5286415 | |
(function($) { | |
// plugin by STRd6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var triggerElement = $(".container") //element to he used to trigger the fixed header | |
, header = $(".header") //element of header | |
, stickyClass = "stickit" // class to be used to give the fixed header a fixed position | |
$(window).scroll(function(){ | |
var offset = 0,sticky = false,top = $(window).scrollTop(); | |
if (triggerElement.offset().top < top) { | |
header.addClass(stickyClass) | |
sticky = true; |