Skip to content

Instantly share code, notes, and snippets.

View etherealite's full-sized avatar

Etherealite etherealite

View GitHub Profile
const fs = require('fs');
const file = fs.readFileSync('contacts.rtf', 'utf8');
const matches = file.match(/\n[a-z ]+.* 0 Y(?:\n.+)+/gi);
const contacts = matches.map(match => {
const lines = match.split("\n");
const contact = Object.create({});
@etherealite
etherealite / rate_limits.rb
Created January 17, 2016 22:53 — forked from jeffrafter/rate_limits.rb
Handle Shopify API rate limits
# https://docs.shopify.com/api/introduction/api-call-limit
module ActiveResource
# 429 Client Error
class RateLimitExceededError < ClientError # :nodoc:
end
class Connection
RATE_LIMIT_SLEEP_SECONDS = 20 # number of seconds to sleep (by sleeping 20 you reset the clock to get 40 fresh burst calls with the default 2 calls/sec)
// parsing http request authorization body
https://regex101.com/r/bO7vG8/5
let pat = /([^=,\s]*)\s*=\s*["'\s]?([^,"]+)["'\s]?/gi;
let WWW-Authenticate =`Digest username="sdfa", realm="dggrs", nonce="0.9645404655020684 ", `+
`uri="/", response="27d9d30c793867d9db15cc69145a72bd", opaque="undefined", qop=auth, `+
`nc=00000001, cnonce="fa56655dc694e1a0"`
@etherealite
etherealite / input.ini
Last active August 29, 2015 14:04
League of Legends easy simultaneous access keybings
; Based on Ideas from a post on the League of Legends subreddit
; http://www.reddit.com/r/leagueoflegends/comments/1bo2nk/guide_to_easy_kiting_left_click_attack/
[HUDEvents]
evtHoldShowScoreBoard=[`]
; camera
evtSelectAlly4=[Shift][z]
evtSelectAlly2=[Shift][x]
@etherealite
etherealite / sample.rb
Created December 25, 2012 10:57
Single query solution to finding nearest donees with matching timeslots
def donees_in_radius_with_timeslots(radius)
required_bits = 2**User.valid_roles.index(:donee)
Location.near(self.location,
radius,
:select => "locations.*, users.*, time_slots.*"
).joins(:user => :time_slots)
.where(["roles_mask & ? > 0", required_bits])
.where(["roles_mask & ? > 0", required_bits])
end