This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TOTP_KEY = 'Pate your TOTP key here. Example: 5ep5abbzomzpen2fpti6hhyu5i' | |
const CSS_SELECTOR = 'Paste your CSS selector here for the TOTP token input. Example: #totp_token' | |
// ---------------------------------------------------------------------------- | |
// Do not change code below this line | |
// ---------------------------------------------------------------------------- | |
totp(TOTP_KEY).then(token => { | |
const element = document.querySelector(CSS_SELECTOR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FLIP = 7 | |
FLOP = 8 | |
print("Player Count\tMinimum N for all to play") | |
for player_count in range(1, 100000): | |
got_to_play = set() | |
direction = 1 | |
player = 0 | |
n = 0 | |
while len(got_to_play) < player_count: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/Dev/Sandbox python flipflop.py | |
With 1 players, ALL players played | |
With 2 players, ALL players played | |
With 3 players, ALL players played | |
With 4 players, ALL players played | |
With 5 players, ALL players played | |
With 6 players, ALL players played | |
With 7 players, ALL players played | |
With 8 players, ALL players played | |
With 9 players, ALL players played |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for player_count in range(1, 10000): | |
got_to_play = set() | |
direction = 1 | |
player = 0 | |
for n in range(1, 1000000): | |
got_to_play.add(player) | |
if got_to_play == set(range(player_count)): | |
break | |
if n % 7 == 0 and n % 8 == 0: # flip flop | |
direction = -direction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: UTF-8 -*- | |
DAYS_OF_THE_WEEK = { | |
"en_US": {"Sunday": 0, "Monday": 1, "Tuesday": 2, "Wednesday": 3, "Thursday": 4, "Friday": 5, "Saturday": 6}, | |
"es_ES": {"Domingo": 0, "Lunes": 1, "Martes": 2, "Miercoles": 3, "Jueves": 4, "Viernes": 5, "Sabado": 6}, | |
"ja_JP": {"日曜日": 0, "月曜日": 1, "火曜日": 2, "水曜日": 3, "木曜日": 4, "金曜日": 5, "土曜日": 6}, | |
} | |
REVERSE_DAYS_OF_THE_WEEK = dict((locale, dict(map(reversed, days.items()))) | |
for locale, days in DAYS_OF_THE_WEEK.items()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createFoo(foo) { | |
// 3rd party lib | |
return newFooId | |
} | |
function deleteFoo(fooId) { | |
// 3rd party lib | |
} | |
function doTheThing() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = {foo: 1, bar: 2, biz: 3, baz: 4} | |
const x = subset(obj, ['foo', 'baz']) | |
// x == {foo: 1, baz: 4} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Angular 1.2+ | |
function sendReq(config, reqData) { | |
/* SNIP */ | |
if (isUndefined(cachedResp)) { | |
var xsrfValue = urlIsSameOrigin(config.url) | |
? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName] | |
: undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery import app | |
app.control.broadcast('my_custom_command') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery.worker.control import Panel | |
@Panel.register | |
def my_custom_command(*args): | |
print('Yay, my custom command just ran!') |
NewerOlder