Skip to content

Instantly share code, notes, and snippets.

View Neppord's full-sized avatar

Samuel Ytterbrink Neppord

View GitHub Profile
@Neppord
Neppord / conditions.js
Created March 2, 2017 12:15
my own notes in discussing style guides
const x = true || false, y = 1, z = 2;
function () {
return x ? y : z;
}
function () {
if (x) {
return y;
}
@Neppord
Neppord / compose
Created May 10, 2015 16:13
compose alias
#! /usr/bin/env bash
set -e
(
__DIR="$PWD"
while [ "$__DIR" != "/" ] && [ ! -e "${__DIR}/docker-compose.yml" ]; do
__DIR=`dirname "$__DIR"`
done
cd "$__DIR"
docker-compose $*
module.exports = {
users: [
{"name": "first_test_user", "password": "this_is_ofc_a_hash_with_salt_etc"}
],
products: [
{"name": "awesome product (tm)", "id": "very unique id"}
]
}
@Neppord
Neppord / patch.js
Created March 16, 2014 01:36
ltc patch
(function (patched) {
if (!patched) {
window.patched = true;
console.log("patched")
}
})(patched)
@Neppord
Neppord / RAINBOWlog.js
Last active August 29, 2015 13:57 — forked from zikes/RAINBOWlog.js
(function(){
var log = console.log;
var css = 'background: linear-gradient(to right, red, yellow, lime, aqua, blue, fuchsia, red); color: white; font-weight: bold; text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;';
function gen_css(){
return css + "font-size: " + (9 + ((Math.random() * 20) << 0)) + "px;"
}
console.log = function(str) {
var args = Array.prototype.slice.call(arguments);
@Neppord
Neppord / package.json
Created May 20, 2013 17:29
testing out cucumber js
{
"private": true
, "name": "mtp"
, "description": "My test project"
, "dependencies": {
"cucumber": "*"
}
}
@Neppord
Neppord / sibling.sh
Created March 22, 2013 14:13
Moduels in BASH
echo $BASH_SOURCE
@Neppord
Neppord / fb.py
Last active December 12, 2015 05:29
fizz buzz
def check(number):
pass
def run_tests():
assert check(1) == 1, "one is not devicible with 3 or 5 so leave it alone"
if __name__ == "__main__":
run_tests()
@Neppord
Neppord / model.js
Last active December 12, 2015 03:18
Trying to understand DS.Model
window.Models = EM.Namespace.create();
DS.RESTAdapter.map('Models.model', {
primaryKey: 'idx'
})
Models.model = DS.Model.extend({
init: function () {
this.super();
Em.run.next({
# -*- coding: utf-8 -*-
"""
>>> update_item(Item("a", 1, 2))
a, 0, 1
>>> update_item(Item("a", 1, 1))
a, 0, 0
>>> update_item(Item("a", 1, 0))
a, 0, 0
>>> update_item(Item("a", 0, 3))
a, -1, 1