Skip to content

Instantly share code, notes, and snippets.

View rjmacarthy's full-sized avatar
🐁
The Tetris effect

rj rjmacarthy

🐁
The Tetris effect
  • The Wilderness
  • 00:04 (UTC +01:00)
View GitHub Profile
@rjmacarthy
rjmacarthy / array-chunk-end.js
Created April 21, 2016 15:06
Get a chunk of array from the end.
var arr = [ -3, 1, 2, -2, 5, 6 ]
var chunkAmount = 3;
var chunk = arr.splice(arr.length-chunkAmount,arr.length);
console.log(chunk) // [-2, 5, 6 ]
@rjmacarthy
rjmacarthy / unique.js
Created April 21, 2016 14:41
Find a unique item in an array.
var orig = [1,1,2,2,3,3,4];
var result;
orig.forEach(function(num, i){
var test = orig.slice(0);
test.splice(i, 1)
if(test.indexOf(num) === -1){
result = num;
}
});
return result; // 4
@rjmacarthy
rjmacarthy / array-shift.js
Created April 21, 2016 14:18
Shift an array.
var arr = [1,2,3,4];
var i = 0, times = 4;
while (i < times) {
arr.unshift(arr.pop());
console.log(arr);
i++;
}
@rjmacarthy
rjmacarthy / slim
Created April 20, 2016 21:57
slim
php -S localhost:8080
mysql -u root -p
@rjmacarthy
rjmacarthy / bcrypt-work-factor.js
Last active March 2, 2017 09:12
Bcrypt work factor testing
var bcrypt = require('bcrypt');
var moment = require('moment');
var _ = require('lodash');
var randomstring = require("randomstring");
var colors = require('colors');
var times = 5;
var i = 0;
var workFactor = 10;
test(randomPassword(), i, workFactor);
@rjmacarthy
rjmacarthy / madge.md
Created April 5, 2016 14:18
madge circular depencency

Navigate to app root

madge --format amd --circular .
@rjmacarthy
rjmacarthy / bitcore-node-testnet.json
Created March 30, 2016 15:43
bitcore-node-testnet.json config
{
"datadir": "./data",
"network": "testnet",
"port": 3001,
"services": [
"address",
"bitcoind",
"db",
"insight-api",
@rjmacarthy
rjmacarthy / sentry
Last active February 26, 2016 12:19
install sentry ubuntu
source /www/sentry/bin/activate
sentry
sentry init /etc/sentry
sudo apt-get update
sudo apt-get install build-essential -y
sudo apt-get install tcl8.5 -y
wget http://download.redis.io/releases/redis-stable.tar.gz
tar xzf redis-stable.tar.gz
cd redis-stable
make
@rjmacarthy
rjmacarthy / rethinkdbssh
Created February 23, 2016 10:01
rethinkdb ssh
`ssh -D <PORT> <LOGIN>@<MACHINE>`
Chrome > settings > proxy settings Set the socks host to and port to you use before.
address:8080 in your browser