Skip to content

Instantly share code, notes, and snippets.

Brad Huber daybreaker

Block or report user

Report or block daybreaker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@daybreaker
daybreaker / dlemoji.rb
Last active Sep 27, 2019
Download and Zip your slack emoji
View dlemoji.rb
# gem install slack-ruby-client rubyzip
# run with: ruby dlemoji.rb
require 'rubygems'
require 'zip'
require 'slack-ruby-client'
require 'open-uri'
token = 'your stripe api token'
directory = '/<absolute/path/to>/emoji/' # The emoji directory must exist, and be empty.
View keybase.md

Keybase proof

I hereby claim:

  • I am daybreaker on github.
  • I am daybreaker (https://keybase.io/daybreaker) on keybase.
  • I have a public key ASCEUAt6wF2hH23KgNdKGvj_z3awkseJV7L4ScLJDwXTGQo

To claim this, I am signing this object:

@daybreaker
daybreaker / reactions.rb
Created May 23, 2018
Ruby script to check slack reaction counts
View reactions.rb
require 'slack-ruby-client'
require 'date'
token = [YOUR TOKEN HERE]
Slack.configure do |config|
config.token = token
end
client = Slack::Web::Client.new
View reaction_count.rb
require 'slack-ruby-client'
require 'byebug'
require 'date'
def count_words(string)
words = string.split(' ')
frequency = Hash.new(0)
words.each { |word| frequency[word.downcase] += 1 }
frequency
end
View gist:de834476c6d398da46610240e0cc2b06
490 -- +1
125 -- 100
120 -- eyes
105 -- clapping
101 -- nice
98 -- ditto
80 -- joy
69 -- heart
67 -- white_check_mark
57 -- nugget
View gist:ab6dbbd8c124cc96bbe05023e3cac455
951 -- joy
746 -- clapping
493 -- heart
454 -- ditto
450 -- +1
387 -- 100
249 -- revelry
192 -- nice
190 -- tada
160 -- wave
View gist:5799336
{
:songkick_id=>"147918",
:videos=>[
{"title"=>"Radio Birdman - New Race", "url"=>"http://www.dailymotion.com/video/x9js5b_radio-birdman-new-race_music", "site"=>"dailymotion.com", "date_found"=>"2013-04-16T00:00:00", "image_url"=>"https://s2-ssl.dmcdn.net/trGO.jpg", "id"=>"710c28f7f2c45e4f570412ee586cd412"},
{"title"=>"Radio Birdman - Aloha Steve & Danno", "url"=>"http://www.dailymotion.com/video/x113dd_radio-birdman-aloha-steve-danno_music", "site"=>"dailymotion.com", "date_found"=>"2013-04-16T00:00:00", "image_url"=>"https://s1-ssl.dmcdn.net/f1D4.jpg", "id"=>"a0fe04216155c2450bf0016f11d8d34d"},
{"title"=>"RADIO BIRDMAN - DIE LIKE APRIL", "url"=>"http://www.youtube.com/watch?v=xfVnsZdE7_U&feature=youtube_gdata_player", "site"=>"youtube.com", "date_found"=>"2013-04-16T00:00:00", "image_url"=>"http://i.ytimg.com/vi/xfVnsZdE7_U/default.jpg", "id"=>"1cc29d48cf5f5a46c779cdc048ef1cbb"},
{"title"=>"Radio Birdman - Man With Golden Helmet", "url"=>"http://www.youtube.com/watch?v=dMlDbT13eXU
View gist:5617610
# model
class Survey < ActiveRecord::Base
CONDITIONS = ["surveys.hotel_id IS NOT NULL"]
end
# controller
conditions = Survey::CONDITIONS
unless params[:time_period].blank?
conditions << "surveys.created_at > '#{params[:time_period].to_i.months.ago}'"
@daybreaker
daybreaker / gist:872706
Created Mar 16, 2011
Better array printing than var_dump
View gist:872706
print("<pre>".print_r($my_array,true)."</pre>");
View Modify Several PHP files
# Needed a script to loop through several php files modify any links, and insert some code into the header of each page.
# Since the header was standard on each page, it was easy enough to match, as were any links
# My question: How could I refactor this to be more efficient than using two different sub/gsubs, and a seperate file write?
Dir.glob('*.php') do |file_name|
#Find one instance of the header, and modify it
content = File.read(file_name).sub(/regex/i, "multiline\nreplacement")
#find every instance of <a href="blah.php"> and modify it to say <a href="blah.php?foo=bar">
You can’t perform that action at this time.