This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A module that allows us to send Backbone events up the tree of components | |
ReactTelegraph = | |
componentWillMount: -> | |
# Make BB events available to the component | |
_.extend @, Backbone.Events | |
componentWillUnmount: -> | |
# Remove all Backbone event listeners | |
@off null, null, null | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#in Terminal | |
sudo killall VDCAssistant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var jq = document.createElement('script'); | |
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"; | |
jq.setAttribute('async', 'true'); | |
document.head.appendChild(jq); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* repeatString() returns a string which has been repeated a set number of times */ | |
function repeatString(str, num) { | |
out = ''; | |
for (var i = 0; i < num; i++) { | |
out += str; | |
} | |
return out; | |
} | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/5108876/kill-a-postgresql-session-connection | |
namespace :db do | |
desc "Fix 'database is being accessed by other users'" | |
task :terminate => :environment do | |
ActiveRecord::Base.connection.execute <<-SQL | |
SELECT | |
pg_terminate_backend(pid) | |
FROM | |
pg_stat_activity | |
WHERE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
//npm install gulp gulp-minify-css gulp-uglify gulp-clean gulp-cleanhtml gulp-jshint gulp-strip-debug gulp-zip --save-dev | |
var gulp = require('gulp'), | |
clean = require('gulp-clean'), | |
cleanhtml = require('gulp-cleanhtml'), | |
minifycss = require('gulp-minify-css'), | |
jshint = require('gulp-jshint'), | |
stripdebug = require('gulp-strip-debug'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// regexp for matching a valid email and populating an array with its parts | |
'e.mail-address@my-domain.co.us'.match(/([a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*)+\@([a-z0-9-]+)\.([a-z.]{2,})/) | |
// returns ['e.mail-address@my-domain.co.us', 'e.mail-address', 'my-domain', 'co.us'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOSTS="router" | |
COUNT=4 | |
for myHost in $HOSTS | |
do | |
count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') | |
echo "Ping count of $count to $myHost at $(date)" >> ~/log/monitor.log | |
if [[ $count == '' ]]; then | |
echo "Host : connection is down (ping failed) at $(date)" >> ~/log/monitor.log | |
reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#From Homebrew/homebrew#10292 https://github.com/Homebrew/homebrew/issues/10292 | |
chown -R $(whoami) /usr/local/.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install dependencies | |
sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm git | |
# clone cpuminer | |
git clone https://github.com/pooler/cpuminer.git | |
# compile | |
cd cpuminer | |
./autogen.sh | |
./configure CFLAGS="-O3" |