Skip to content

Instantly share code, notes, and snippets.

View jonataswalker's full-sized avatar
💭
I may be slow to respond.

Jonatas Walker jonataswalker

💭
I may be slow to respond.
View GitHub Profile
@jonataswalker
jonataswalker / readme.md
Created November 8, 2015 19:26 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@jonataswalker
jonataswalker / object-watch.js
Created November 25, 2015 18:33 — forked from flackjap/object-watch.js
Fork of object.watch polyfill in ES5. Modified to not react when the value set is the same as previous.
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
*
* Modified by Nenad Damnjanović
* Nov 9, 2014
@jonataswalker
jonataswalker / Makefile
Last active February 17, 2016 13:12
A build process to a HTML/JavaScript/CSS project.
INDEX_DIR := /home/www/project-foo
BUILD_DIR := $(INDEX_DIR)/build
JS_DEBUG := $(BUILD_DIR)/app-debug.js
JS_FINAL := $(BUILD_DIR)/app.js
CSS_COMBINED := $(BUILD_DIR)/app-combined.css
CSS_FINAL := $(BUILD_DIR)/app.css
# src files
JS_FILES := wrapper-head.js \
utils.js \
app.js \
@jonataswalker
jonataswalker / .eslintrc
Created March 30, 2016 16:46 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@jonataswalker
jonataswalker / Howto.md
Created May 4, 2016 18:55 — forked from n1k0/Howto.md
CasperJS test cli hooks example

Put test1.js and test2.js into a tests/ directory, then run the suite:

$ casperjs test tests/ --pre=pre.js --includes=inc.js --post=post.js
Test file: /Users/nperriault/tmp/pre-inc/pre.js                                 
Hey, I'm executed before the suite.
Test file: /Users/nperriault/tmp/pre-inc/tests/test1.js                         
# this is test 1
Hi, I've been included.
PASS Subject is strictly true
@jonataswalker
jonataswalker / 1_phantomErrors.js
Created May 5, 2016 00:40 — forked from artjomb/1_phantomErrors.js
Error event handlers for PhantomJS and CasperJS: PhantomJS and CasperJS don't show errors on the page by default. This can give clues as to what did go wrong.
var page = require('webpage').create(),
url = 'http://example.com/';
// Put the event handlers somewhere in the code before the action of
// interest (opening the page in question or clicking something)
// http://phantomjs.org/api/webpage/handler/on-console-message.html
page.onConsoleMessage = function(msg, lineNum, sourceId) {
console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")');
};
@jonataswalker
jonataswalker / LICENSE.txt
Created June 8, 2016 19:55 — forked from binarymax/LICENSE.txt
Powerset from array
Copyright (c) 2011 Max Lovenheim Irwin, http://binarymax.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@jonataswalker
jonataswalker / bsort.js
Created June 9, 2016 22:41 — forked from tixxit/bsort.js
Fast Bucket Sort for Integers in JS
// Copyright 2011, Tom Switzer
// Under terms of ISC License: http://www.isc.org/software/license
/**
* Sorts an array of integers in linear time using bucket sort.
* This gives a good speed up vs. built-in sort in new JS engines
* (eg. V8). If a key function is given, then the result of
* key(a[i]) is used as the integer value to sort on instead a[i].
*
* @param a A JavaScript array.
/**
* An implementation for Quicksort. Doesn't
* perform as well as the native Array.sort
* and also runs the risk of a stack overflow
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {
* array.push(Math.round(Math.random() * 100));
[
{
"stream": {
"mature": false,
"status": "Greg working on Electron-Vue boilerplate w/ Akira #programming #vuejs #electron",
"broadcaster_language": "en",
"display_name": "FreeCodeCamp",
"game": "Creative",
"language": "en",
"_id": 79776140,