Skip to content

Instantly share code, notes, and snippets.

View nervetattoo's full-sized avatar

Raymond Julin nervetattoo

View GitHub Profile
@nervetattoo
nervetattoo / app.js
Created December 11, 2012 05:02
Simple script loader
define(['dependency'], function(Dependency)
{
console.log("Dependency loaded", Dependency);
});
@nervetattoo
nervetattoo / console.log.vim
Created September 6, 2012 08:13
console.log in vim
" Console log from insert mode; Puts focus inside parentheses
imap cll console.log();<Esc>==f(a
" Console log from visual mode on next line, puts visual selection inside parentheses
vmap cll yocll<Esc>p
" Console log from normal mode, inserted on next line with word your on inside parentheses
nmap cll yiwocll<Esc>p
@nervetattoo
nervetattoo / machine.js
Created April 16, 2021 09:53
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@nervetattoo
nervetattoo / .hyper.js
Created December 19, 2016 12:03
hyperjs
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
@nervetattoo
nervetattoo / async-auto.js
Last active December 10, 2016 09:42
promises-promises-promises
async.auto({
get_data: function(callback){
console.log('in get_data');
// async code to get some data
callback(null, 'data', 'converted to array');
},
make_folder: function(callback){
console.log('in make_folder');
// async code to create a directory to store a file in
// this is run at the same time as getting the data
#include "neopixel.h"
#define PIXEL_COUNT 29
#define PIXEL_PIN D2
#define PIXEL_TYPE WS2812B
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
int pos = -1;
@nervetattoo
nervetattoo / main.cpp
Last active October 30, 2016 13:58
Neopixel
#include "neopixel.h"
#define PIXEL_COUNT 29
#define PIXEL_PIN D2
#define PIXEL_TYPE WS2812B
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
void setup() {
strip.begin();
strip.show();
@nervetattoo
nervetattoo / Cat.js
Last active June 7, 2016 12:46
HOC Api inspired by refetch and recompose for simply assigning api data as props with "middleware" for authorization
import 'withApi' from './withApi.js'
const Cat = ({cat}) => <span>{cat.name} says {cat.purr}</span>
const enhance = withApi(props => ({
cat: `/api/cat/${props.id}`
}))
export default enhance(Cat)
@nervetattoo
nervetattoo / its-karakterer.js
Last active May 14, 2016 10:38
its-karakterer
// ==UserScript==
// @name its-karakterpoeng
// @namespace http://your.homepage/
// @version 0.8
// @description enter something useful
// @author You
// @match http*://hfk.itslearning.com/*
// @grant unsafeWindow
// @run-at context-menu
// ==/UserScript==
@nervetattoo
nervetattoo / amd-config.js
Last active December 20, 2015 17:09
How to handle left/right/up/down swipes for the Leap Motion controller
require.config({
paths: {
leap : '//js.leapmotion.com/0.2.0/leap'
},
shim: {
exports: 'Leap'
}
});
define(['leap'], function(Leap) {