Skip to content

Instantly share code, notes, and snippets.

@bbarrows
bbarrows / LiveThread.py
Created June 25, 2012 17:56
LiveThread
import threading, logging, traceback
import sys, time
class LiveThread(threading.Thread):
def __init__(self, function_to_quit_the_process, thread_wait_in_seconds=1,
clean_up_wait_in_seconds=1, group=None, target=None, name="LiveThread",
args=(), kwargs={}, verbose=None, clean_up=None):
threading.Thread.__init__(self, group=group, target=target, name=name,
args=args, kwargs=kwargs, verbose=verbose)
self._function_to_quit_the_process = function_to_quit_the_process
#!/usr/bin/env python
from os import listdir
from os.path import isfile, join
from subprocess import Popen, PIPE, STDOUT, call
import MySQLdb
import MySQLdb.cursors
import types
import warnings
let fibonacci = {
[Symbol.iterator]() {
let pre = 0, cur = 1;
return {
next(p) {
console.log(p);
pre = cur
cur = pre + cur
//[pre, cur] = [cur, pre + cur];
if (cur < 100) {
var arr = [4,5,6,7,8,9];
for (var v of arr) {
console.log( v );
}
// 4 5 6 7 8 9
// define iterator that only produces values
// from odd indexes
arr[Symbol.iterator] = function*() {
var idx = 1;
do {
# well not sure how far u wanted that to go..
# I had to google some quick info/docs. for ex forgot method notation meaning of !
# Otherwise I think import stuff should be here. Relationships of models (which I am not 100% on but
# I would figure it out from docs if spent more time..), business logic, exceptions and
# transactions..
# I havent used rails in a while so little rusty but I know I could always get back up to speed
# really quick.. Had to learn React this week for ex..
# Hope its good enough, left a lot of comments to explain the craziness. Thanks for your time
downloadEmbededVideos();
/**
* Finds and downloads all embeded Vimeo videos.
*/
function downloadEmbededVideos() {
// Find Vimeo embed frame
var embedFrames = document.querySelectorAll('iframe[src*="player.vimeo.com"]');
@bbarrows
bbarrows / index.haml
Created September 28, 2017 21:09
MuchCleanerOpaqueTileHoverAway
/* Original is 1600px by 1200px */
/* I want width of 900pxxso */
/* (90x0/1600)*1200 = 675px */
/* Surface area of back is then */
/* 900 * 675 = 607500 */
/* 607500 / ( 10 * 10) = */
/* 6075 */
/* 607500/50 = 12150 */
@bbarrows
bbarrows / index.html
Created October 1, 2017 07:07
motion graphic typeface
<canvas id="canvas" style="position:absolute; top:0; left:0;"></canvas>
<div id="buffer" style="display:none;">
@bbarrows
bbarrows / index.html
Created October 1, 2017 07:07
motion graphic typeface
<canvas id="canvas" style="position:absolute; top:0; left:0;"></canvas>
<div id="buffer" style="display:none;">
@bbarrows
bbarrows / disable.sh
Created October 9, 2017 22:54
Disable bunch of #$!@ in Sierra (Version 2.1)
#!/bin/bash
# IMPORTANT: You will need to disable SIP aka Rootless in order to fully execute this script, you can reenable it after.
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
# Agents to disable
TODISABLE=('com.apple.security.keychainsyncingoveridsproxy' 'com.apple.personad' 'com.apple.passd' 'com.apple.screensharing.MessagesAgent' 'com.apple.CommCenter-osx' 'com.apple.Maps.mapspushd' 'com.apple.Maps.pushdaemon' 'com.apple.photoanalysisd' 'com.apple.telephonyutilities.callservicesd' 'com.apple.AirPlayUIAgent' 'com.apple.AirPortBaseStationAgent' 'com.apple.CalendarAgent' 'com.apple.DictationIM' 'com.apple.iCloudUserNotifications' 'com.apple.familycircled' 'com.apple.familycontrols.useragent' 'com.apple.familynotificationd' 'com.apple.gamed' 'com.apple.icloud.findmydeviced.findmydevi