Skip to content

Instantly share code, notes, and snippets.

View tlemburg's full-sized avatar

Tyler Lemburg tlemburg

View GitHub Profile
@tlemburg
tlemburg / gist:dcb648bb93b07c6f169a
Created October 1, 2014 18:55
Doing the XOR operator in javascript.
Boolean.prototype.xor = function (other) {return (!this && Boolean(other)) || (this && !Boolean(other))}
@tlemburg
tlemburg / gist:b07b1f42b0a57a961072
Created March 5, 2015 02:57
Error log for packaged shoes apps not opening
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGBUS (0xa) at pc=10717bb4d, pid=407, tid=140735198561024
#
# JRE version: 7.0
# Java VM: OpenJDK 64-Bit Server VM (21.0-b17 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# V [libjvm.dylib+0x3deb4d] SharedRuntime::resolve_sub_helper(JavaThread*, bool, bool, Thread*)+0x1a9
#
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.
# Marker to tell the VCL compiler that this VCL has been adapted to the
# new 4.0 format.
// ==UserScript==
// @name Trello Card Numbers
// @namespace http://
// @version 0.1
// @description Shows card numbers on trello. New cards don't get this usually so you may need to refresh the page.
// @author Tyler Lemburg
// @match https://trello.com/*
// @grant none
// ==/UserScript==

Installation

This procedure is tested on Mac OS X 10.10.5 with Developpers tools installed (xCode).

PHP 5.6 installed with Homebrew.

Preparation

Download the following files from Oracle website (yes, you need to create an account and accept terms):

@tlemburg
tlemburg / bls_data.json
Last active August 20, 2019 00:20
BLS Data JSON
[{"name": "Jobs", "_collapsed":"true", "children": [{"name": "Architecture & engineering", "_collapsed":"true", "children": [{"name": "Engineers", "children": [{"name": "Civil engineers"}, {"name": "Computer hardware engineers"}, {"name": "Electrical & electronics engineers", "children": [{"name": "Electrical engineers"}, {"name": "Electronics engineers, except computer"}]}, {"name": "Engineers, all other"}, {"name": "Industrial engineers, including health & safety", "children": [{"name": "Health & safety engineers, except mining safety engineers & inspectors"}, {"name": "Industrial engineers"}]}, {"name": "Chemical engineers"}, {"name": "Petroleum engineers"}, {"name": "Marine engineers & naval architects"}, {"name": "Mining & geological engineers, including mining safety engineers"}, {"name": "Biomedical engineers"}, {"name": "Materials engineers"}, {"name": "Nuclear engineers"}, {"name": "Agricultural engineers"}, {"name": "Environmental engineers"}, {"name": "Aerospace engineers"}, {"name": "Mechanical
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
title,Hierarchy,Occupation.type,Employment.2016,Employment.2026,ChgEmploy.2016to26.Num,ChgEmploy.2016to26.Perc,Percent.self.employed..2016,Occupational.openings..2016.26.annual.average,Median.annual.wage..2017.1.,Typical.education.needed.for.entry,Work.experience.in.a.related.occupation,Typical.on.the.job.training.needed.to.attain.competency.in.the.occupation,Level0,Level1,Level2,Level3,Level4,pathString,jobcol,percentchg.indx,percentchg.col
"Total, all",0,Summary,"156,063.80","167,582.30","11,518.60",7.4,6.1,"18,742.00","$37,690 ",NA,NA,NA,Jobs,NA,NA,NA,NA,Jobs,white,11,#FF9200
Architecture & engineering,1,Summary,"2,601.00","2,795.40",194.3,7.5,2.7,210.1,"$79,180 ",NA,NA,NA,Jobs,Architecture & engineering,NA,NA,NA,Jobs/Architecture & engineering,#984EA3,11,#FF9200
"Architects, surveyors, etc",2,Summary,210.9,225.3,14.5,6.9,15.3,16.7,"$72,020 ",NA,NA,NA,Jobs,Architecture & engineering,"Architects, surveyors, etc",NA,NA,"Jobs/Architecture & engineering/Architects, surveyors, etc",#984EA3,11,#FF9200
"Architect
[{"name":"Jobs","children":[{"name":"Management occupations","children":[{"name":"Top executives","children":[{"name":"Chief executives"},{"name":"General & operations managers"},{"name":"Legislators"}],"_collapsed":true},{"name":"Advertising, marketing, etc","children":[{"name":"Advertising & promotions managers"},{"name":"Marketing & sales managers","children":[{"name":"Marketing managers"},{"name":"Sales managers"}],"_collapsed":true},{"name":"Public relations & fundraising managers"}],"_collapsed":true},{"name":"Operations specialties managers","children":[{"name":"Administrative services managers"},{"name":"Computer & information systems managers"},{"name":"Financial managers"},{"name":"Industrial production managers"},{"name":"Purchasing managers"},{"name":"Transportation, storage, etc"},{"name":"Compensation & benefits managers"},{"name":"Human resources managers"},{"name":"Training & development managers"}],"_collapsed":true},{"name":"Other management occupations","children":[{"name":"Farmers, rancher
def flatten(array)
new_arr = []
array.each do |item|
if item.is_a?(Array)
flatten(item).each do |inner|
new_arr << inner
end
else
new_arr << item
end
@tlemburg
tlemburg / app.rb
Created September 18, 2020 19:04
Sample Cognito webhook receiver
require 'sinatra'
require 'json'
require 'openssl'
require 'base64'
ENDPOINT_SECRET = 'fe1eb40c8e8d2164ffff0316a40e5f237f2e2742877e6c47a969643411547f74'
post '/webhook' do
puts ""
puts 'Webhook received!'