Skip to content

Instantly share code, notes, and snippets.

View parabuzzle's full-sized avatar

Mike Heijmans parabuzzle

View GitHub Profile
[14] pry(main)> Post.find_by_provider_and_identifier(:twitter, '515632050511298560')
[DB Master] Post Load (1.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."provider" = 'twitter' AND "posts"."identifier" = '515632050511298560' ORDER BY created DESC LIMIT 1
=> #<Post id: 33867995, user_id: 5623, identity_id: 22113, identifier: "515632050511298560", title: nil, picture: nil, url: "https://twitter.com/1OfficialAsh/status/51563205051...", body: "😂😂😂 The way everyone in my household is silent and ...", likes_count: 0, comments_count: nil, shares_count: 0, created_at: "2015-03-30 22:45:22", updated_at: "2015-03-30 22:45:22", created: "2014-09-26 22:40:35", provider: "twitter", video: nil, impressions_count: 824, meta: {}, hidden: false>
[15] pry(main)> ArchivedPost.find_by_provider_and_identifier(:twitter, '515632050511298560')
[DB Master] ArchivedPost Load (1.1ms) SELECT "archived_posts".* FROM "archived_posts" WHERE "archived_posts"."provider" = 'twitter' AND "archived_posts"."identifier" = '515632050511

Keybase proof

I hereby claim:

  • I am parabuzzle on github.
  • I am parabuzzle (https://keybase.io/parabuzzle) on keybase.
  • I have a public key whose fingerprint is 6BB3 8B60 290D 7D70 73F8 6AC6 47C8 1660 6AE2 998A

To claim this, I am signing this object:

@parabuzzle
parabuzzle / mensa_number.rb
Created March 21, 2015 17:37
Mensa number question
#!/usr/bin/env ruby
# Find a SIX digit number in which the FIRST digit is ONE more than the THIRD,
# the SECOND digit is ONE less than the FOURTH, the FIFTH digit is ONE less than
# the THIRD, and the SIXTH digit is ONE more than the FOURTH. The sum of the
# SECOND and THIRD digits equal the FIRST. The sum of all digits is 30.
# Returns 6 digit numbers that the sum of the digits are 30
def possible_numbers
numbers = []
require 'httparty'
hipchat_token = ENV['HIPCHAT_TOKEN']
hipchat_email = ENV['HIPCHAT_EMAIL']
hipchat_api = ENV['HIPCHAT_API'] || 'api.hipchat.com'
url = "https://#{hipchat_api}/v2/user/#{hipchat_email}?auth_token=#{hipchat_token}"
user = JSON.parse HTTParty.get(url).body
{
"tab_size": 2,
"translate_tabs_to_spaces": true,
"color_scheme": "Packages/User/Colorsublime/themes/Merbivore.tmTheme",
"ensure_newline_at_eof_on_save": true,
"trim_trailing_white_space_on_save": true,
"rulers":
[
80,
120
@parabuzzle
parabuzzle / rebase
Created October 13, 2014 16:55
rebase my current branch off of master!
alias rebase!="git rebase -i `git merge-base \`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'\` master`"
@parabuzzle
parabuzzle / gist:74ccc41c7712fd12d45a
Last active August 29, 2015 14:06
User config for sublime
{
"tab_size": 2,
"translate_tabs_to_spaces": true,
"ensure_newline_at_eof_on_save": true
}
@parabuzzle
parabuzzle / jekyll_dev.rb
Last active August 29, 2015 14:06
A simple little ruby script for starting a jekyll server and builder
#!/bin/env ruby
require 'thread'
# Set the process name
$0 = 'jekyll_dev'
# Environment
ENV['JEKYLL_WITH_DRAFTS'] ||= 'true'
@parabuzzle
parabuzzle / drainswap.sh
Created August 27, 2014 12:41
drainswap
#!/bin/bash
free_data="$(free)"
mem_data="$(echo "$free_data" | grep 'Mem:')"
free_mem="$(echo "$mem_data" | awk '{print $4}')"
buffers="$(echo "$mem_data" | awk '{print $6}')"
cache="$(echo "$mem_data" | awk '{print $7}')"
total_free=$((free_mem + buffers + cache))
used_swap="$(echo "$free_data" | grep 'Swap:' | awk '{print $3}')"
#!/usr/bin/env ruby
require 'json'
ARGV.each do |file|
begin
JSON.parse(File.open(file).read)
puts "you're good! :: #{file}"
rescue
puts "FAIL! :: #{file}"