Skip to content

Instantly share code, notes, and snippets.

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

richy rjmacarthy

🎮
The Tetris effect
View GitHub Profile
@rjmacarthy
rjmacarthy / subdomain
Created January 27, 2016 12:24
Node.js Nginx Subdomain
server {
listen 80;
server_name www.subdomain.domain.com;
return 301 subdomain.domain.com;
}
server {
listen 80;
server_name subdomain.domain.com;
@rjmacarthy
rjmacarthy / HowTo.md
Created February 17, 2016 14:03
Webpack frontend / backend

Backend reload

forever --watch --watchDirectory="./server/" server/app.js

Front end reload

webpack-dev-server --hot --inline --history-api-fallback

Webpack config with proxy for backend.

@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 / 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",
mysql -u root -p
@rjmacarthy
rjmacarthy / madge.md
Created April 5, 2016 14:18
madge circular depencency

Navigate to app root

madge --format amd --circular .
@rjmacarthy
rjmacarthy / slim
Created April 20, 2016 21:57
slim
php -S localhost:8080
@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 / 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-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 ]