Skip to content

Instantly share code, notes, and snippets.

View Dottenpixel's full-sized avatar

dugg molidor Dottenpixel

View GitHub Profile
# 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
@Dottenpixel
Dottenpixel / gist:47152dc1c91c32f09892
Last active August 29, 2015 14:08
Macbook Pro - built-in camera not working
#in Terminal
sudo killall VDCAssistant
@Dottenpixel
Dottenpixel / gist:19f9388d6eb4f0f6abeb
Last active August 29, 2015 14:08
Load jQuery asynchronously in closure
(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);
})();
/* 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;
}
/*
# 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
'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'),
// 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']
#!/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
@Dottenpixel
Dottenpixel / gist:9756464
Last active August 29, 2015 13:57
Useful tip to fix permissions from Homebrew/legacy-homebrew#10292
#From Homebrew/homebrew#10292 https://github.com/Homebrew/homebrew/issues/10292
chown -R $(whoami) /usr/local/.git
# 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"