Skip to content

Instantly share code, notes, and snippets.

View stigok's full-sized avatar
🚢
ship it!

Stig Otnes Kolstad stigok

🚢
ship it!
View GitHub Profile
@stigok
stigok / reset.css
Created April 28, 2015 18:38
reset.css with Eric Meyer CSS Reset + Paul Irish border-box: none
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@stigok
stigok / .eslintrc.js
Last active February 19, 2016 01:20 — forked from i-van/.eslintrc
ESLint rules my ego likes
module.exports = {
'rules': {
'indent': [
2,
2
],
'quotes': [
2,
'single'
],
@stigok
stigok / helpers.js
Last active March 10, 2016 20:38
Express web-server for Angular app with cached HTTP API backend
'use strict';
module.exports.jsonResponseObject = function jsonResponseObject(err, data) {
return {
meta: {
status: err ? (err.status || 500) : 200,
message: err ? (err.message || 'Error') : 'OK'
},
response: data || {}
};
@stigok
stigok / taskforce.js
Created March 10, 2016 21:12
Node.js Task & Worker
'use strict';
const _ = require('underscore');
function Task(fn) {
this.fn = fn;
}
function Worker(interval, tasks) {
this.interval = interval;
@stigok
stigok / materialize-base-colors.json
Created May 1, 2016 01:40
Materialize base colors JSON array
["red", "pink", "purple", "deep-purple", "indigo", "blue", "light-blue", "cyan", "teal", "green", "light-green", "lime", "yellow", "amber", "orange", "deep-orange", "brown", "grey", "blue-grey"]
@stigok
stigok / closet.sh
Last active May 25, 2016 22:34
Bash utility to copy a skeleton directory to predefined target path
#!/bin/bash
# Set $skeleton to desired path and rename the file to e.g. closet.sh
# Set $path to desired target directory to raise the skeleton
# Usage: closet project-name
name=$1
path=~/repos/$name
skeleton=~/repos/sshow-node-module-skeleton
if [ "$1" == "--current" ]; then
@stigok
stigok / whothis.sh
Created May 27, 2016 03:47
Which pacman package supplies this binary
#!/usr/bin/env bash
echo "Who this :) <21"
if [ "$1" = "" ]; then
echo "Missing arg"
exit 1
fi
filepath=$(which $1 2> /dev/null)
@stigok
stigok / ago.js
Last active February 24, 2017 15:32
Lightweight relative time ago in English
const SECOND = 1000
const MINUTE = SECOND * 60
const HOUR = MINUTE * 60
const DAY = HOUR * 24
function timeAgo (date) {
const delta = Date.now() - parseInt(date)
const ago = {
day: delta / DAY,
hour: delta / HOUR,
@stigok
stigok / hextime.sh
Last active March 23, 2017 14:00
Get current system time as hex string
#!/bin/bash
# Get zero-padded hex string from date format
# Usage: f <format>
function f {
printf %02X $(date +$1)
}
h=$(f %-H)
m=$(f %-M)
#!/bin/bash
# made for tghack '17
# desc: upload a file chunked through a shell with length
# restrictions of commands. you might need to manually
# tune the BUFLEN to stay within the limits. sh syntax
# errors appears when you're out of bounds.
#
# todo: progress bar
#
HOST=${1}