Skip to content

Instantly share code, notes, and snippets.

@scopevale
scopevale / a-simple-socket-io-test.md
Created September 4, 2017 08:41 — forked from janusnic/a-simple-socket-io-test.md
A simple Socket.io test with client and server (Node.js) parts.
@scopevale
scopevale / .eslintrc
Created July 7, 2017 13:17 — forked from alefteris/.eslintrc
ESLint default config in YAML format
---
parser: espree
env:
amd: false
browser: false
es6: false
jasmine: false
jquery: false
meteor: false
mocha: false
@scopevale
scopevale / ramda-promises.js
Created June 26, 2017 21:25 — forked from andre487/ramda-promises.js
Ramda promises
var Fs = require('fs');
var Http = require('q-io/http');
var Q = require('q');
var R = require('ramda');
var readFile = R.composeP(R.toString, R.partial(Q.ninvoke, Fs, 'readFile'));
var readPackageInfo = R.composeP(JSON.parse, readFile, R.partial(Q, 'package.json'));
var homePageFromAuthor = R.compose(R.propOr('', 1), R.match(/.+?\((.+?)\)$/), R.prop('author'));
function getImportsFromFile(fileName) {
const readline = require('readline');
const fs = require('fs');
const imports = [];
return new Promise((resolve, reject) => {
const readStream = fs.createReadStream(fileName);
readStream.on('error', (err) => reject(err));
const rl = readline.createInterface({input: readStream});
@scopevale
scopevale / tmux.cheat
Created June 1, 2017 08:40 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@scopevale
scopevale / mocha-guide-to-testing.js
Created May 8, 2017 08:38 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@scopevale
scopevale / RAFPlugin.js
Created March 6, 2017 11:06 — forked from ischenkodv/RAFPlugin.js
Jasmine plugin to test functions with requestAnimationFrame.
/**
* Jasmine RequestAnimationFrame: a set of helpers for testing funcionality
* that uses requestAnimationFrame under the Jasmine BDD framework for JavaScript.
*/
;(function() {
var index = 0,
callbacks = {};
function MockRAF(global) {
@scopevale
scopevale / component.js
Created February 15, 2017 14:50
jasmine's spyOn() + React.js + ES6
import React from 'react';
import _ from 'lodash';
import PubSub from 'pubsub-js';
class Example extends React.Component{
bar(e){
console.log('Bar called')
}
render() {
return(
@scopevale
scopevale / cycle-metasyntactic-variables.vim
Last active February 21, 2017 17:18 — forked from hail2u/cycle-metasyntactic-variables.vim
'foo', 'bar', 'baz', 'qux', 'quux', 'corge', 'grault', 'garply', 'waldo', 'fred', 'plugh', 'xyzzy', 'thud'
" Cycle metasyntactic variables
function! s:CycleMetasyntacticVariables(num)
if type(a:num) != type(0)
return
endif
let vars = ['foo', 'bar', 'baz', 'qux', 'quux', 'corge', 'grault', 'garply', 'waldo', 'fred', 'plugh', 'xyzzy', 'thud']
let cvar = expand('<cword>')
let i = index(vars, cvar)
@scopevale
scopevale / cookie.js
Created October 14, 2016 14:45 — forked from bradrice/cookie.js
Set, get and delete a cookie