Skip to content

Instantly share code, notes, and snippets.

View sbrocher's full-sized avatar

Sebastian Brocher sbrocher

  • Noctual
  • Austin, TX
View GitHub Profile
@aunyks
aunyks / erc721-example.sol
Last active April 12, 2024 00:56
My implementation of the ERC721 token standard. WARNING: THIS CODE IS FOR EDUCATIONAL PURPOSES. DO NOT DEPLOY TO THE NETWORK.
pragma solidity ^0.4.19;
contract ERC721 {
string constant private tokenName = "My ERC721 Token";
string constant private tokenSymbol = "MET";
uint256 constant private totalTokens = 1000000;
mapping(address => uint) private balances;
mapping(uint256 => address) private tokenOwners;
mapping(uint256 => bool) private tokenExists;
mapping(address => mapping (address => uint256)) private allowed;
mapping(address => mapping(uint256 => uint256)) private ownerTokens;
@bibendi
bibendi / README.md
Last active May 8, 2018 05:03
Kontena rails app

Usage

Setup kontena.io

$ gem install kontena-cli
$ kontena login {ip}
$ kontena grid use staging
$ kontena vpn config > kontena.ovpn
$ sudo openvpn --config kontena.ovpn --script-security 2 --daemon
@belsrc
belsrc / gist:672b75d1f89a9a5c192c
Last active April 15, 2023 15:13
Simple Vue.js filters that I usually need
/**
* Changes value to past tense.
* Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc.
* http://jsfiddle.net/bryan_k/0xczme2r/
*
* @param {String} value The value string.
*/
Vue.filter('past-tense', function(value) {
// Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing
var vowels = ['a', 'e', 'i', 'o', 'u'];
@Rayjax
Rayjax / 1-screenshot.js
Last active July 4, 2017 21:16
Take fast screenshots with Phantom.js from Node.js
/*
original : https://gist.github.com/BinaryMuse/2378993
Changes :
-Shares an instance of phantomJS for all requests instead of creating a new one for each
-Sends the created file as a response
-Uses good old JavaScript
-Coffee version below
*/
var phantom = require('phantom'),
@swrobel
swrobel / spree_1.3.3_to_2.0.4.md
Last active December 18, 2018 16:48
HOWTO: Upgrade Spree 1.3.3 to 2.0.4

HOWTO: Upgrade Spree 1.3.3 to 2.0.4

These steps were sufficient to upgrade Cult Cosmetics to Spree 2.0.4 from 1.3.3. Here are some details on our environment.

  • We only have single-variant products
  • We are not making use of stock locations (single warehouse)
  • Frontend entirely overridden w/ custom bootstrap layout
  • Braintree gateway
  • Rails 3.2.14
  • Upgraded from Ruby 1.9.3-p448 to 2.0.0-p247 in the process (no issues)
@endymion
endymion / contact.rb
Last active February 18, 2024 22:49
Example of integrating a Ruby on Rails app with Zapier using the REST hooks pattern. With support for triggering the REST hooks from Resque background jobs.
class Contact < ActiveRecord::Base
...
def after_create
if Hook.hooks_exist?('new_contact', self)
Resque.enqueue(Hook, self.class.name, self.id)
# To trigger directly without Resque: Hook.trigger('new_contact', self)
end
end
@madhums
madhums / mapreduce.js
Created August 3, 2011 20:33
mapreduce using mongodb and mongoose
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/db_name');
// map function
var map = function(){
emit(this.field_to_group_by, {
other_fields: this.other_fields
// list other fields like above to select them
})
}