Skip to content

Instantly share code, notes, and snippets.

Avatar

Jake Worth jwworth

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am jwworth on github.
  • I am jwworth (https://keybase.io/jwworth) on keybase.
  • I have a public key ASCQ0HZP2qsuBnqHaZ4f_RWQmQQbL98412fii0hHEdChZQo

To claim this, I am signing this object:

View Split Deckset-style Markdown Slides in Separate Files
#!/usr/bin/env ruby
slides_to_split = File.read('slides.md')
slide_data = slides_to_split.split("\n---\n\n")
slide_data.each_with_index do |data, index|
File.write("slides/#{index.to_s.rjust(2, '0')}.md", data)
end
@jwworth
jwworth / React-Rails + Redux Vim Projections
Last active Oct 6, 2017
react_rails_redux.projections.json
View React-Rails + Redux Vim Projections
{
"app/javascript/packs/components/*.js": {
"command": "component"
},
"app/javascript/packs/containers/*.js": {
"command": "container"
},
"app/javascript/packs/reducers/*.js": {
"command": "reducer"
},
@jwworth
jwworth / logrotate.conf
Created Mar 10, 2017
Sample Logrotater for a Linux Server running Ruby on Rails
View logrotate.conf
# Logrotater:
# - Daily
# - Timestamped
# - Doesn't error on missing log files
# - Keeps seven copies
# - Truncates log files (allows Rails to start writing to the new log file without
# a restart)
/var/app/current/log/production.log {
daily
@jwworth
jwworth / react_on_rails.projections.json
Last active Aug 10, 2017
'React On Rails' Vim Projections
View react_on_rails.projections.json
{
"client/app/actions/*.js": {
"command": "actions"
},
"client/app/containers/*.js": {
"command": "container"
},
"client/app/components/*.jsx": {
"command": "component"
},
@jwworth
jwworth / phoenix_1_3.projections.json
Last active Aug 10, 2017
Phoenix 1.3 Vim Projections
View phoenix_1_3.projections.json
{
"lib/tilex_web/models": {
"type": "model"
},
"lib/tilex_web/models/*.ex": {
"type": "model",
"alternate": "test/models/{}_test.exs",
"template": [
"defmodule {project|camelcase|capitalize|basename}.{camelcase|capitalize|dot} do",
" use {project|camelcase|capitalize|basename}Web, :model",
@jwworth
jwworth / page_objects.projections.json
Last active Aug 10, 2017
RSpec Page Objects Projections
View page_objects.projections.json
{
"spec/support/pages/*_page.rb": {
"command": "page",
"template": [
"module Pages",
" class {camelcase|capitalize}Page < Page",
" end",
"end",
]
},
@jwworth
jwworth / led.rb
Created Feb 11, 2016
LED (Ruby Solution)
View led.rb
# LED Clock: You are (voluntarily) in a room that is completely dark except for
# the light coming from an old LED digital alarm clock. This is one of those
# clocks with 4 seven segment displays using an HH:MM time format. The clock is
# configured to display time in a 24 hour format and the leading digit will be
# blank if not used. What is the period of time between when the room is at its
# darkest to when it is at its lightest?
def compute_brightness(units)
cells_per_number = [ 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
@jwworth
jwworth / from_one_end_to_the_other.elm
Last active Jan 29, 2016
From One End to the Other (Elm)
View from_one_end_to_the_other.elm
import Graphics.Element exposing (show)
import Array exposing (..)
import String exposing (..)
magicNumber : Array Int
magicNumber =
let
isNumber number =
String.right 1 (toString(number)) == "6" &&
(String.append "6" (String.dropRight 1 (toString(number))))
@jwworth
jwworth / from_one_end_to_the_other.lua
Created Jan 25, 2016
From One End To The Other (Lua)
View from_one_end_to_the_other.lua
-- Week 4: From One End to the Other: Find the smallest possible (positive)
-- integer that ends in a six such that if that six is removed and placed in front
-- of the remaining digits of the number, the resulting number will be four times
-- as large as the original.
function swap_first_and_last(t, n)
table.insert(t, 1, n)
return tonumber(table.concat(t))
end