Skip to content

Instantly share code, notes, and snippets.

View djbender's full-sized avatar
🕵️‍♂️

Derek Bender djbender

🕵️‍♂️
View GitHub Profile
@djbender
djbender / Gemfile
Created December 12, 2018 17:21 — forked from palkan/Gemfile
RSpec profiling with RubyProf and StackProf
gem 'stackprof', require: false
gem 'ruby-prof', require: false
@djbender
djbender / thread.rb
Created March 25, 2018 14:58 — forked from alyssais/thread.rb
My really hacky livetweeting script. You pass in the ID of the tweet to continue the thread from.
require "yaml"
require "twitter"
config = YAML.load_file(File.expand_path("~/.trc")).dig("profiles", "qyliss").each_value.first
last_status = ARGV.fetch(0)
twitter = Twitter::REST::Client.new do |t|
t.consumer_key = config.fetch("consumer_key")
t.consumer_secret = config.fetch("consumer_secret")
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@djbender
djbender / init.lua
Created December 27, 2016 05:14 — forked from RichardForrester/init.lua
Karabiner Elements and Hammerspoon on MacOS Sierra
-- ln -s ~/repos/config/init.lua ~/.hammerspoon/init.lua
-- Global variable for the Command Mode
cMode = hs.hotkey.modal.new({}, "F17")
-- Global variable for Delete Mode
dMode = hs.hotkey.modal.new({}, 'F20')
-- Global variable for Select Mode
sMode = hs.hotkey.modal.new({}, 'F19')
accomplished
aggravated
amused
angry
annoyed
anxious
apathetic
artistic
awake
bitchy
class @Reloader
constructor: (@selector = '.wrapper', @path, @interval = 2000) ->
@start()
start: =>
@timer = setInterval(@fetch, @interval)
stop: =>
clearInterval(@timer)
AWS.config(access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'] )
S3_BUCKET = AWS::S3.new.buckets[ENV['S3_BUCKET']]
desc "Running all the benchmarks and writing results to file"
task :benchmark do
STDOUT.puts("Benchmarking:")
Dir[File.join(File.dirname(__FILE__), "bench", "**", "*.rb")].each do |benchmark|
STDOUT.puts <<-DOCUMENT
---
file: #{benchmark}
platform: #{RUBY_DESCRIPTION}
timestamp: #{Time.now}
results: |
# config/routes.rb
resources :documents do
resources :versions, controller: "documents/versions" do
post :restore, on: :member
end
resource :lock, controller: "documents/locks"
end
When starting a project that includes refinerycms-blog:
$ rake refinery:override view=refinery/pages/*
$ rake refinery:override view=layouts/*
$ rake refinery:override view=refinery/blog/shared/*
$ rake refinery:override view=refinery/blog/posts/*
$ rake refinery:override view=refinery/*
$ rake refinery:override controller=refinery/blog/*
$ rake refinery:override controller=refinery/*