Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
There is a difference between a peasant and a knight

Romuald Quantin soundstep

💭
There is a difference between a peasant and a knight
View GitHub Profile
View todomvc tests errors
╰─$ mocha allTests.js --reporter spec --framework=angularjs 26 ↵
TodoMVC - angularjs
No Todos
✓ should hide #main and #footer (93ms)
New Todo
1) should allow me to add todo items
2) should clear text input field when an item is added
3) should append new items to the bottom of the list
View dabblet.css
.button
{
display: inline-block;
white-space: nowrap;
background-color: #ccc;
background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ccc));
background-image: -webkit-linear-gradient(top, #eee, #ccc);
background-image: -moz-linear-gradient(top, #eee, #ccc);
background-image: -ms-linear-gradient(top, #eee, #ccc);
background-image: -o-linear-gradient(top, #eee, #ccc);
View javascript hash map
var HashMap = function(){
var uuid = function(a,b){for(b=a='';a++<36;b+=a*51&52?(a^15?8^Math.random()*(a^20?16:4):4).toString(16):'-');return b;}
var getKey = function(target) {
if (!target) return;
if (typeof target !== 'object') return target;
return target.hashkey ? target.hashkey : target.hashkey = uuid();
}
return {
put: function(key, value) {
this[getKey(key)] = value;
View dabblet.css
.square {
width: 100px;
height: 100px;
background: red;
margin: 5px;
}
.animated {
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
View dabblet.css
.square {
width: 100px;
height: 100px;
background: red;
margin: 5px;
}
.animated {
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
View dabblet.css
div {
background-color: #ccc;
margin: 20px;
width: 50px;
height: 50px;
-webkit-animation-duration: 1s;
-webkit-animation-timing-function: ease-out;
}
@soundstep
soundstep / package.json
Created Aug 15, 2013
Auto install (preinstall) grunt-cli from package.json
View package.json
{
"name": "Project name",
"version": "0.0.0",
"author": "Author name",
"scripts": {
"preinstall": "which -s grunt && grunt --version | grep grunt-cli > /dev/null 2>&1; if [[ \"$?\" != 0 ]]; then npm install grunt-cli -g; exit 0; fi"
},
"devDependencies": {
"grunt": "~0.4.1"
}
@soundstep
soundstep / 0_reuse_code.js
Created Nov 27, 2013
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@soundstep
soundstep / gist:8041814
Last active Dec 31, 2015
soma several instance (coupon example)
View gist:8041814
// Code goes here
window.widgets = window.widgets || {};
window.widgets.coupons9 = window.widgets.coupon9 || {};
(function(ns, soma) {
'use strict';
var CouponsMediator = function(target, dispatcher, dataService, couponsTemplate) {
@soundstep
soundstep / gist:7774021
Created Dec 3, 2013
Javascript linked list (reverse)
View gist:7774021
var Node = function(data, next) {
this.data = data;
this.next = next;
};
var node1 = new Node('id1',
new Node('id2',
new Node('id3',
new Node('id4')
)