Skip to content

Instantly share code, notes, and snippets.

View abrkn's full-sized avatar

Andreas Brekken abrkn

View GitHub Profile
@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 / 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) {
@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)) {
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, {
@matiu
matiu / gist:3305c42b341916fb7afc
Last active August 29, 2015 14:05
Copay: Remove transaction proposals

Remove TxProposals

@jbergstroem
jbergstroem / iojs-1.0.4.ebuild
Last active August 29, 2015 14:14
io.js ebuild
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=5
PYTHON_COMPAT=( python2_{6,7} )
MY_PV="v${PV}"
MY_P="${PN}-${MY_PV}"
@zelig
zelig / gist:adcbb8cd4e9c8259327c
Last active August 29, 2015 14:18
local ethereum cluster
# !/bin/bash
# bash cluster <cluster_root> <number_of_clusters> <network_id> <runid> <local_IP> [[params]...]
# sets up a local ethereum network cluster of nodes
# - <n> is the number of clusters
# - <root> is the root directory for the cluster, the nodes are set up
# with datadir `<root>/00`, `<root>/01`, ...
# - new accounts are created for each node
# - they launch on port 30300, 30301, ...
# - they star rpc on port 8100, 8101, ...
@simenbrekken
simenbrekken / CategoryStore.js
Last active August 29, 2015 14:19
Relay-style higher-order React components backed by Reflux
var Reflux = require('reflux')
var axios = require('axios')
var CategoryStore = Reflux.createStore({
init: function() {
this.items = null
},
list: function() {
var items = this.items
@abrkn
abrkn / gist:4170859
Created November 29, 2012 18:10
Offline wallets
1GiX5QLSqe8GKBH4bW97xK1H1JGfMmdJuT
SPENT
-----BEGIN PGP MESSAGE-----
Version: GnuPG v2.0.17 (MingW32)
hQEMA8c3OfKU6OsOAQgAq5sMPnbdh8MaHgEUYYQ0vBpKdT3ShI3SjMfT1H5s0hIW
GshQZgbwrSOM5FCqas9krBxxEkxX+MBUfqACC2LwIno5lwjvfR6/DliOEBrUg4Rj
4xgz2wR0fLZbV6RX4I2+u2vvzi5qiIbXKfAELxfFkD/5DniiW4zinq8fjrMZquRC
KkzxXC3qU1YEiR8oZya/AdRl+pmfvweXruE4+JXbmASIvV0uHjsFafoZa17DgwFK
@simenbrekken
simenbrekken / SublimeLinter.sublime-settings
Last active December 17, 2015 20:59
SublimeLinter configuration
{
"jshint_options": {
"browser": true, // This option defines globals exposed by modern browsers: all the way from good ol' document and navigator to the HTML5 FileReader and other new developments in the browser world.
"devel": true, // This option defines globals that are usually used for logging poor-man's debugging: console, alert, etc.
"expr": true, // This option suppresses warnings about the use of expressions where normally you would expect to see assignments or function calls. Most of the time, such code is a typo. However, it is not forbidden by the spec and that's why this warning is optional.
"globals": {
"_": false // I usually include lodash/underscore in all my projects so feel free to remove this
},
"indent": 4, // This option enforces specific tab width for your code.
"jquery": true, // This option defines globals exposed by the jQuery JavaScript library.