Skip to content

Instantly share code, notes, and snippets.

View thanpolas's full-sized avatar

Thanos Polychronakis thanpolas

View GitHub Profile
body {
background: blue;
padding:0;
}
header {
height: 200px;
background-color: red;
margin: 0;
display:block;
<!-- The result of the popup window -->
<script>opener.ss.user.tw.oauthToken('token-312123123');close();</script>
@thanpolas
thanpolas / promises.js
Created March 14, 2013 14:21
promises "resolve" !== "fullfill"
var def1 = when.defer();
var def2 = when.defer();
def1.promise.then(function( arg1 ) {
arg1 === def2.promise;
});
@thanpolas
thanpolas / Gruntfile.js
Created March 21, 2013 13:11
A required Gruntfile config
module.exports = function (grunt) {
multiTask: {
options: {
anObject: {
a: 1
}
},
target: {
options: {
anObject: {
@thanpolas
thanpolas / app.js
Created April 4, 2013 14:51
Multiple promise callbacks
// calling multiple callbacks for a promise
var promise = fnReturnsPromise();
promise.then(fn1);
promise.then(fn2);
// that is not the same ?
fnReturnsPromise().then(fn1).then(fn2);
@thanpolas
thanpolas / test.js
Created April 11, 2013 22:00
Testing promises with mocha
var assert = require('chai').assert;
var when = require('when');
var def1 = when.defer();
function getProm() {
return def1.promise;
}
@thanpolas
thanpolas / perf.js
Last active December 16, 2015 04:19
when.sequence execution penalty
//var PerfTime = require('perf-time');
//var _ = require('underscore');
var Perf = module.exports = function() {
this.startTime = null;
// this.t = new PerfTime();
this.t = {
get: function() {
return Date.now();
}
@thanpolas
thanpolas / Gruntfile.js
Last active December 18, 2015 02:58
Node Server + Grunt Watch Tasks + Livereload using one command: grunt
module.exports = function (grunt) {
grunt.initConfig({
watch: {
options: {
livereload: true
},
// triggering livereload when the .css file is updated
// (compared to triggering when sass completes)
// allows livereload to not do a full page refresh
styles: {
@thanpolas
thanpolas / doodle.js
Created June 11, 2013 16:24
Promises doodle
function retProm() {
var def = when.defer();
return def.resolve();
}
console.log('one');
retProm().then(function(){console.log('two'));
console.log('three');
@thanpolas
thanpolas / Gruntfie.js
Last active December 26, 2015 16:48
Grunt Config for node server + livereload
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
express: {
options: {
// Override defaults here
},
web: {
options: {