Skip to content

Instantly share code, notes, and snippets.

View abrkn's full-sized avatar

Andreas Brekken abrkn

View GitHub Profile
#!/bin/sh
BOOT2DOCKER_CERTS_DIR=/var/lib/boot2docker/certs
CERTS_DIR=/etc/ssl/certs
CAFILE=${CERTS_DIR}/ca-certificates.crt
for cert in $(/bin/ls -1 ${BOOT2DOCKER_CERTS_DIR}); do
SRC_CERT_FILE=${BOOT2DOCKER_CERTS_DIR}/${cert}
CERT_FILE=${CERTS_DIR}/${cert}
HASH_FILE=${CERTS_DIR}/$(/usr/local/bin/openssl x509 -noout -hash -in ${SRC_CERT_FILE} 2>/dev/null)
@matiu
matiu / gist:3305c42b341916fb7afc
Last active August 29, 2015 14:05
Copay: Remove transaction proposals

Remove TxProposals

@xmlking
xmlking / Enum.es6.js
Last active June 25, 2019 18:09
JavaScript Enums with ES6, Type Checking and Immutability
export class EnumSymbol {
sym = Symbol.for(name);
value: number;
description: string;
constructor(name: string, {value, description}) {
if(!Object.is(value, undefined)) this.value = value;
if(description) this.description = description;
var Constants = require('../constants')
exports.query = function() {
this.dispatch(Constants.Referred.QUERY)
api.call('v1/referred')
.then(function(data) {
this.dispatch(Constants.Referred.QUERY_COMPLETED, data)
}.bind(this), function(err) {
this.dispatch(Constants.Referred.QUERY_FAILED, {
@stefansundin
stefansundin / git-bundle-hook.md
Last active February 1, 2024 06:42 — forked from 8bitDesigner/1.md
Git post-checkout and post-merge hooks to simplify bundling and other tasks.

Make bundleing and npm installing easy

These git hooks runs bundle or npm install automatically whenever you:

  • git checkout a new branch with a different Gemfile or package.json.
  • git pull a change to Gemfile or package.json.

How to install

  1. cd awesome_git_repo
@simenbrekken
simenbrekken / DataManifestMixin.js
Created March 21, 2014 13:44
React Store + DataManifest Prototype
'use strict';
var rsvp = require('rsvp'),
lodash = require('lodash'),
invariant = require('react/lib/invariant')
function resolve(resource) {
if (resource instanceof rsvp.Promise) {
return resource
} else if (lodash.isArray(resource)) {
@simenbrekken
simenbrekken / example.js
Last active August 29, 2015 13:57
Simple RegExp-based Router
// "Routes"
function Home() {
console.log('Home')
}
function Products(params) {
console.log(params.category, 'products')
}
function ProductDetails(params) {
@colingourlay
colingourlay / app.jsx
Created February 26, 2014 23:58
Using react-router-component to drive the routing of a Cordova app (while still working as a web app).
function init() {
var HomePage = React.createClass({
render: function() {
return <div>Home</div>;
}
});
var NotFoundPage = React.createClass({
render: function() {
@simenbrekken
simenbrekken / plugins.js
Created June 25, 2013 07:34
Various jQuery convenience plugins
$.fn.template = function(selector) {
return $(this).find(selector + '[data-template]').removeAttr('data-template').remove()
}
$.fn.rows = function(columns) {
var children = $(this).children().get()
while (children.length) {
var chunk = children.splice(0, columns)
$(chunk).wrapAll('<div class="row' + (chunk.length % 2 ? ' uneven' : '') + '">')
@simenbrekken
simenbrekken / bank-accounts.css
Last active December 18, 2015 09:48
State driven Stylus
.visible-empty {
display: block;
}
.is-empty .visible-empty,
.has-empty .visible-empty {
display: none;
}
.is-empty .hidden-empty,
.has-empty .hidden-empty {
display: none;