Skip to content

Instantly share code, notes, and snippets.

View mholubowski's full-sized avatar

Mike Holubowski mholubowski

  • PLY Technologies
  • California
View GitHub Profile
@mholubowski
mholubowski / gist:9628521
Created March 18, 2014 20:13
gh function
# Opens the github page for the current git repository in your browser
# git@github.com:jasonneylon/dotfiles.git
# https://github.com/jasonneylon/dotfiles/
function gh() {
giturl=$(git config --get remote.origin.url)
if [ "$giturl" == "" ]
then
echo "Not a git repository or no remote.origin.url set"
exit 1;
fi
@mholubowski
mholubowski / gist:9629304
Created March 18, 2014 20:51
git autocomplete
# add to ~./bash_profile
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# create this file in `~/.git-completion.bash`
#!bash
#
# bash/zsh completion support for core Git.
#
@mholubowski
mholubowski / holke.rb
Created May 1, 2014 03:28
Ruby Problem
# The variable raw_name_data is set to the multiline
# string surrounded by 'datablock'
raw_name_data = <<-datablock
Name: Mike bullshit bullshit bullshit bullshit bullshit
Age: 13 bullshit bullshit bullshit bullshit bullshit
bullshit bullshit bullshit bullshit bullshit bullshit
bullshit bullshit bullshit bullshit bullshit bullshit
bullshit bullshit bullshit bullshit bullshit bullshit
bullshit bullshit bullshit Name: Nick Age: 22 bullshit
bullshit bullshit bullshit bullshit bullshit bullshit
@mholubowski
mholubowski / kw_queue.rb
Created July 23, 2014 21:28
KMR KeywordQueue
module KeywordQueue
extend self
QUEUE_KEY = 'keyword-queue'
LOCK_KEY = 'keyword-queue:lock'
DELAY_TIME = 1 # Time in seconds between scrape batches
KW_FAILURES_KEY = 'keyword_queue:keyword_failures'
KW_FAILED_QUEUE_KEY = 'keyword_queue:failed_keywords'
KW_FAILURE_THRESHOLD = 5
@mholubowski
mholubowski / app JS - mike ho.co
Created November 30, 2012 06:10
Snippets of mikeho.co to show FindTheBest
function replaceProject(linkTarget) {
var area = $('#projectArea');
area.animate({right: '100%'}, 500, function() {
area.load(linkTarget + ' ' + '#projectArea');
area.animate({right: '0%'},1000, null);
urlSwap(linkTarget);
});
}
@mholubowski
mholubowski / threads.rb
Last active December 18, 2015 01:29
What goes down here? Why doesn't each thread end in succession?
def print_every_3_seconds num
5.times do
puts "Thread #{num}"
sleep 3
end
puts "** DONE #{num} **"
end
(1..100).each do |num|
Thread.new do
@mholubowski
mholubowski / gist:5904945
Created July 1, 2013 21:49
prevent heroku idling
# in /tasks/scheduler.rake
desc "Called by Heroku cron add-on to stop spin down"
task :call_page => :environment do
uri = URI.parse('http://www.mikeholubowski.com/')
Net::HTTP.get(uri)
puts 'Pinged the site!'
end
# then use the heroku cron add-on to schedule it for every x minutes
NotificationSubscription.where(confirmed: true)
.joins(property: :feedback_inputs)
.where("feedback_inputs.created_at >= :cutoff", {cutoff: 1.hour.ago})
@mholubowski
mholubowski / v1-api-notifyIO.rb
Last active December 25, 2015 18:38
V1 api documentation for notify.IO
# in gemfile
gem 'notifyIO'
# in config
notifier = NotifyIO::Notifier.new(auth_token: '12309jdsjLIJDwdsf')
# in controller or model
notifier.send do |n|
n.type = :alert
@mholubowski
mholubowski / stresser.conf
Last active December 29, 2015 09:29
Stresser configuration file for NotifyIO (CS 290B - Scalable Internet Services)
# MPPerf Configuration File
# The host, URI (relative to the document root) and port to test.
host = NotifyIO-LB-972606977.us-east-1.elb.amazonaws.com
uri =/organizations/2
port = 80
# The 'rate' is the number of number of connections to open per second.
# A series of tests will be conducted, starting at low rate,
# increasing by rate sep, and finishing at high_rate.