Skip to content

Instantly share code, notes, and snippets.

View dpritchett's full-sized avatar
🦅
microservice party

Daniel Pritchett ⚡ dpritchett

🦅
microservice party
View GitHub Profile
@dpritchett
dpritchett / tabkill.rb
Created November 4, 2018 14:27
kill an active chrome tab using the DevTools API
#!/usr/bin/env ruby
require 'json'
require 'thread'
def eep
`mplayer #{ENV['HOME'] + '/.killsound'}`
end
def tabs
184 meltheous
164 gpspake tbqh
110 syliddar
98 dpritchett is happy
54 vongrippen
46 bkmontgomery
40 sbramlett
36 dan9186
32 my username can be as long as I damn well please GEORGE
32 B R Y C E
@dpritchett
dpritchett / search_fatwallet.py
Created November 17, 2010 22:07
Use this as a cron job maybe?
import feedparser, re #feedparser available at http://feedparser.org/
def search_fatwallet(keyword):
fw = feedparser.parse(r'http://feeds.feedburner.com/FatwalletHotDeals')
for entry in fw.entries:
if re.search(keyword, entry['title']):
print entry['title'], '\n', entry['feedburner_origlink']
print ''
"""
>>> search_fatwallet('car')
@dpritchett
dpritchett / notes.md
Last active February 27, 2018 16:34
ssl blog on gh pages notes
#!/usr/bin/env sh
cd /Users/daniel/Projects/book/dpchat/Book
./rake clean screen &> log/build_log.txt
if ! grep 'Build failed' log/build_log.txt; then
# osascript is osx-only
osascript -e 'display notification "✅ Success! ✅" with title "bookbuild"'
echo BUILD SUCCEEDED
  • interpreter: A program that reads a plain text source code file and attempts to execute the contents
  • shell: a program that enables users to interactively explore their local operating system: its files, its utilities, and its peripherals. Examples: Bash, Powershell
  • string: a representation of plain text data => "hello".class => String
  • integer: a whole number => 100.class => Integer
  • function: a segment of code defined and named for reuse
       def hi(name)
         puts "Hi, #{name}!"
       end
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
// GLOBAL OBJECT THINGIES
// setInterval returns a number that you can save here.
// When you're ready to stop the active timer you pass the saved number to clearInterval and the timer stops.
// This way you can track multiple timers running concurrently in a complex app.
var mainTimerHandle = null;
// these are simple javascript objects.
// this is an Array of three Objects, each of which has a startAt number and a current number.
var clocks = [
  • In the context of the window, start a timer (setInterval) to do a thing every 1000 ms
  • that thing: tryToTickEachClockOnce():
    • find all clocks on the page
    • for each of those clocks, call decrementByOneSecondUnlessAlreadyZero(thisClockInParticular)