Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🚀

Ben Woodward benwoodward

💭
🚀
View GitHub Profile
@benwoodward
benwoodward / new-files.sh
Created Feb 26, 2020
Mac/Zsh-only: List new files recursively by date created within current directory. Displays relative dates.
View new-files.sh
relative-date() {
while read input_string; do
local file_path=`echo $input_string | cut -d ' ' -f 5`
local ls_date=`echo $input_string | cut -d ' ' -f 1,2,3,4`
# Accepts date in format found in `ls` output, and converts to epoch
local date="$(date -j -f "%d %b %H:%M:%S %Y" "$ls_date" +"%s")"
local now="$(date +"%s")"
local time_diff=$((now - date))
if ((time_diff > 24*60*60)); then
@benwoodward
benwoodward / unclap.rb
Last active Jun 23, 2018
Script to unclap/unrecommend all stories on Medium
View unclap.rb
require 'rubygems'
require 'selenium-webdriver'
class Unclap
USERNAME = "@yourusername"
def initialize
@driver = Selenium::WebDriver.for :chrome
@links_to_unclap = []
@problem_links = []
@benwoodward
benwoodward / # macvim - 2016-04-19_09-57-26.txt
Created Apr 19, 2016
macvim on Mac OS X 10.11.3 - Homebrew build logs
View # macvim - 2016-04-19_09-57-26.txt
Homebrew build logs for macvim on Mac OS X 10.11.3
Build date: 2016-04-19 09:57:26
@benwoodward
benwoodward / do_end.sublime-snippet
Created Oct 12, 2014
Sublime Text Snippet for simple "do ... end", because typing do+enter annoyingly activates the 'dob' (do |variable| .. end) snippet, which is not always what you want.
View do_end.sublime-snippet
<snippet>
<content><![CDATA[do$do
$0
end]]></content>
<tabTrigger>do</tabTrigger>
<scope>source.ruby</scope>
<description>do … end</description>
</snippet>
View keybase.md

Keybase proof

I hereby claim:

  • I am benwoodward on github.
  • I am benwoodward (https://keybase.io/benwoodward) on keybase.
  • I have a public key whose fingerprint is 8CB4 B3A3 55DC D852 72E0 CF5B DC0B 197A B188 0BE3

To claim this, I am signing this object:

@benwoodward
benwoodward / haml_data-attributes.haml
Created Aug 12, 2014
How to convert html 5 data attributes in haml to html
View haml_data-attributes.haml
%table.table.table-bordered.table-striped#sortable{:data => {update_url:
sort_admin_things_path}}
View sass-modules.md

SASS Modules

Goals

  • modularity
  • encapsulation
  • predictability
  • extensibility
  • integrability
  • explicitness
View .gitconfig
[difftool "Kaleidoscope"]
cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
[diff]
tool = Kaleidoscope
[difftool]
prompt = false
[mergetool "Kaleidoscope"]
cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
trustExitCode = true
[mergetool]
View overrides.rb
class ActiveAdmin::Views::Pages::Base < Arbre::HTML::Document
def build_page_content
build_flash_messages
div :id => "active_admin_content", :class => (skip_sidebar? ? "without_sidebar" : "with_sidebar") do
build_sidebar unless skip_sidebar?
build_main_content_wrapper
end
end
@benwoodward
benwoodward / postgres_role.sh
Created Mar 1, 2013
Create a new role in postgres
View postgres_role.sh
createuser -s -U $USER
You can’t perform that action at this time.