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 / 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)
@dpritchett
dpritchett / policy.xml
Created May 3, 2016 21:21
imagetragick fixed policy.xml example - see the last block
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policymap [
<!ELEMENT policymap (policy)+>
<!ELEMENT policy (#PCDATA)>
<!ATTLIST policy domain (delegate|coder|filter|path|resource) #IMPLIED>
<!ATTLIST policy name CDATA #IMPLIED>
<!ATTLIST policy rights CDATA #IMPLIED>
<!ATTLIST policy pattern CDATA #IMPLIED>
<!ATTLIST policy value CDATA #IMPLIED>
]>
$ bx cap staging deploy:assets:backup_manifest -vvvv
triggering load callbacks
* 2016-04-29 18:35:26 executing `staging'
triggering start callbacks for `deploy:assets:backup_manifest'
* 2016-04-29 18:35:26 executing `multistage:ensure'
* 2016-04-29 18:35:26 executing `deploy:assets:backup_manifest'
* executing "ls /var/www/sites/dpritchettapp.com/shared/assets/manifest*"
servers: ["staging-li.dpritchettapp.net"]
[staging-li.dpritchettapp.net] executing command
command finished in 298ms