Skip to content

Instantly share code, notes, and snippets.

View brandonhilkert's full-sized avatar

Brandon Hilkert brandonhilkert

View GitHub Profile
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install vim tmux git build-essential openssl-dev libxml2-dev python2.7 python2.7-dev fuse libtool autoconf libusb-1.0-0-dev libfuse-dev
pip install cython
pip3 install cython
mkdir ios && cd ios
git clone https://github.com/libimobiledevice/libplist.git
class MegaLotto
NUMBERS = 5
def draw
NUMBERS.times.inject([]) do |arr, i|
arr << single_draw
end
end
private

Signup

  • GET /partners/signup will create the requested user in Bark

This endpoint requires request signing authentication

Required parameters:

  • pk - the primary key of the user in your data store
select '2017-02-19'::date as start, ('2017-02-19'::date + interval '30 days') as future
2017-02-19 2017-03-21 00:00:00
select '2017-02-19'::date as start, ('2017-02-19'::date + interval '1 month') as future
2017-02-19 2017-03-19 00:00:00
@brandonhilkert
brandonhilkert / application_presenter.rb
Created April 21, 2017 14:19
Basic presenters without gem
class ApplicationPresenter
def self.presents(name)
define_method(name) do
@object
end
end
def initialize(object, template = nil)
@object, @template = object, template
end
def connection_link
if likely_private_messages_connection?
["#", { data: { toggle: "modal", target: "#no-activities-modal" } }]
else
h.child_path(connection.child)
end
end
class IncrementConnectionStatWorker
include Sidekiq::Worker
def perform(activity_id)
a = Activity.find(activity_id)
# I had previously used .find_or_initialize_by
# but that proved to not be thread-safe on the incrementing
stat = ConnectionStat.find_by(
day: Time.zone.now.to_date,
@brandonhilkert
brandonhilkert / Gemfile
Last active January 12, 2016 23:10 — forked from ntl/Gemfile
source "https://rubygems.org"
gem "whatever"
# Load minitest and red-green
group :minitest do
gem "minitest"
gem "minitest-rg"
end
require 'sinatra/base'
class FakeGitHub < Sinatra::Base
def simulate_error!
@@simulate_error = true
end
def reset!
@@simulate_error = false
end
#!/bin/bash
count=$(ls -l $1 | wc -l)
if test $count -gt 20
then
echo "Too many mails!"
exit 1
else
exit 0