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
@grndrth
grndrth / gist:e739883687b14f8b060b
Created October 12, 2015 19:27
Setting up Karma with Mocha, Chai, Babel, CommonJS. Everything else in karma.conf.js can be left at standard settings.
// Karma configuration
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
@rxaviers
rxaviers / merge.js
Last active December 24, 2015 02:59
Merge javascript JSON's
function merge() {
var i, json,
jsons = [];
for ( i = 0; i < arguments.length; i++ ) {
json = JSON.stringify( arguments[ i ] ).replace( /^{/, "" ).replace( /}$/, "" );
if ( json ) {
jsons.push( json );
}
}
return JSON.parse( "{" + jsons.join( "," ) + "}" );
@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,
@wnordmann
wnordmann / index.html
Created March 3, 2011 03:53
This is a fun scratch off image page using HTML, it will be the base idea for a larger project.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>HTML5 Canvas Scratch-off Demo</title>
<style type="text/css">
body {

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

#!/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}
@stigok
stigok / ip6tables-rules
Last active July 4, 2017 08:54
ip6tables restore script for /etc/network/if-up.d
#!/bin/bash
#
# Restores ip6tables configuration.
# Expected to reject everything BUT:
# - icmpv6 from anywhere
# - ssh (22/tcp) from a whitelisted ipv6 subnet
# - openvpn (1094/udp) from anywhere
#
# stigok, july 2017
@stigok
stigok / soundcloudplayer.js
Last active May 28, 2019 06:59
Angular.js SoundCloud player widget directive
angular.module('ngApp')
.directive('soundCloudPlayer', function () {
return {
restrict: 'E',
template: '<iframe width="100%" height="465" scrolling="no" frameborder="no"></iframe>',
link: function (scope, element, attrs) {
var iframe = element.find('iframe');
var settings = [
'buying=false',
'liking=false',
{ stdenv, pkgs, lib, ... }:
{
# IPv6 is supported, but this example is for IPv4
networking.wg-quick.interfaces = {
wg0 = {
address = [ "10.7.0.1/32" ];
peers = [
{
publicKey = "ABCABCABC";
allowedIPs = [ "0.0.0.0/0" ];
@stigtsp
stigtsp / overlays-default.nix
Created May 13, 2020 09:43
nix overlay example
# .config/nixpkgs/overlays/default.nix
self: super:
let
callPackage = super.lib.callPackageWith super;
in
{
packer = super.callPackage ./pkgs/packer {};
}