Skip to content

Instantly share code, notes, and snippets.

View moskyb's full-sized avatar

Ben Moskovitz moskyb

View GitHub Profile
@moskyb
moskyb / .hyper.js
Created January 8, 2017 22:07
My Hyper Config
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
/**
* Looks for an existing transcript and reads it into an array if found.
* If the file doesn't exist it creates a new transcript.
*
* @param file File to read from
* @throws IOException
*/
public void readFile(File file) throws IOException {
Charset charset = Charset.forName("utf-8");
Arraylist<String> someList = new Arraylist<String>();
{
"id": "2",
"name": "Dogs",
"prompt": "Which type of dog is the best?",
"answers": [
{
"id": "1",
"answer_text": "Golden Retriever",
"num_votes": 1
},
if @member.years[0]
year_numbers = @member.years.map { |year|
year.description.to_i
}.sort
first_year = year_numbers.shift
year_numbers.reduce([[first_year]]) do |year_collection, year|
if year_collection[-1][1] == year-1 || !year_collection[-1][1]
(year_collection[-1][1] = year; year_collection)
else
(year_collection)+[[year]]
void ((*volatile p)()); p = (void ((*)()))
# Obviously change the namelist to whoever is in the secret santa draw.
santalist = "Helena, Jason, Jess, Kah, Matai, James, Kavi, Caitlin, Ben, Shan, Launa, Nic".split(", ").shuffle
santalist.each_cons(2) do |pairing|
puts "#{pairing[0]} -> #{pairing[1]}"
end
puts "#{santalist[-1]} -> #{santalist[0]}"
def needs_washup?(mech, invoice_rel)
# Gets some info from the page at billing.flickelectric.co.nz/#{invoice_rel},
# checks if the accuracy_status of the invoice is actual, and if the total due
# equals 0. If accuracy_status is actual and total due != 0, return true, else false
page = mech.get("https://uat-billing.flickelectric.co.nz/" + invoice_rel)
accuracy_status = page.search('dl[id="invoice_details"]').to_s.include?("actual")
invoice_lines = page.search('tfoot[class~="invoice-totals"]').children
# Strip out all of the whitespace
totals = invoice_lines.text.gsub(/\s+/, "")
# Iterate backwards through until we get a $ character - this index will be