Skip to content

Instantly share code, notes, and snippets.

@amaranter
amaranter / MerkleTree.js
Created August 13, 2017 21:51
Merkle Tree Implementation with Javascript and CryptoJS (SHA-256)
/**
* MerkleTree Implementation
* @version 1.0.0
* @author Ronny Amarante <me@amaranter.com>
*/
var SHA256 = require("crypto-js/sha256");
function MerkleTree(transactions) {
this.transactions = transactions;
@glamrock
glamrock / data_brokers.txt
Created December 5, 2016 20:40
A simply complicated guide to removing your info from data brokers
I've compiled a list of data
aggregators, data brokers, direct marketing firms, and others who trade
personal data. Many of these are very quickly dealt with via web forms,
but others require a letter and a copy of a photo ID. Many of the data
brokers came from my notes, but others have come from Reddit threads,
and stopdatamining.me. All sources were fairly out of date, so I've gone
through and listed the current contact info and process for each. Feel
free to pass it along and let me know if there are any errors or
omissions. ^_^
@unbug
unbug / Middleware.js
Last active January 6, 2024 04:17
Powerful Javascript Middleware Pattern Implementation, apply middleweares to any object. https://unbug.github.io/js-middleware/
'use strict';
/* eslint-disable consistent-this */
let middlewareManagerHash = [];
/**
* Composes single-argument functions from right to left. The rightmost
* function can take multiple arguments as it provides the signature for
* the resulting composite function.
*
@ef4
ef4 / select.hbs
Last active October 7, 2021 09:41
Goodbye old Select View
<select onchange={{action (mut vehicle) value="target.value"}}>
{{#each vehicles key="@item" as |vehicleChoice|}}
<option value={{vehicleChoice}} selected={{eq vehicle vehicleChoice}}>{{vehicleChoice}}</option>
{{/each}}
</select>
@derekclee
derekclee / compressed_svg.rb
Last active March 22, 2018 14:53
Compressing static svg files for the rails asset pipeline
# I used https://github.com/eliotsykes/rack-zippy to serve gzipped static assets.
# By default the rails asset pipeline was not compressing any static svg files,
# so I did the following to achive that.
#
# First create a rake task that will fine and compress svg files.
# File: lib/tasks/assets_svg_compress.rake
namespace :assets do
task :svg_compress => :environment do
svg_files = Dir["./public/**/*.svg"]
svg_files.each do |file|
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active May 1, 2024 23:17
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@jonahoffline
jonahoffline / revX_refactoring_example.rb
Last active December 11, 2015 01:59
Refactoring examples using code taken from revXbot.
#Original
# If you were down with this you are a code martyr waiting for a stab.
# Ruby was born so that code could be drier than your Grandma.
# The first any? method is as useless as a PHP Senior Developer so I ain't worried!
# The @offenders hash always get saved using the store method so cut that bitch off!
if @offenders.any? && @offenders.key?(nick)
@offenders.store(nick, @offenders.fetch(nick).next)
else
@offenders.store(nick, 1)
@awidegreen
awidegreen / vim_cheatsheet.md
Last active April 30, 2024 16:14
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close