Skip to content

Instantly share code, notes, and snippets.

View jpsilvashy's full-sized avatar
🎯
Focusing

JP Silvashy jpsilvashy

🎯
Focusing
View GitHub Profile
@jpsilvashy
jpsilvashy / clock_angles.rb
Created August 9, 2014 08:46
clock_angles
def clock_angles(time)
hour, min = time.split(":").map(&:to_i)
ans = ((hour * 30 + min * 0.5) - (min * 6)).abs
[360 - ans, ans].min
end
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
" Learn vim navigation!
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
@jpsilvashy
jpsilvashy / keybase.md
Last active August 29, 2015 14:23
keybase.md

Keybase proof

I hereby claim:

  • I am jpsilvashy on github.
  • I am jpsilvashy (https://keybase.io/jpsilvashy) on keybase.
  • I have a public key whose fingerprint is 3113 805F 8E68 1E41 E6EA 2AFD 84D3 466E 3F7B EA1F

To claim this, I am signing this object:

@jpsilvashy
jpsilvashy / tic-tac-toe.txt
Last active August 29, 2015 14:25
tic-tac-toe
Spend no more than 2 hours building a Rails (or Sinatra) app that allows the player to play a game of tic-tac-toe. This should be for 2 human players, so no AI is needed (unless you wanted to make this harder for yourself).
Don't worry about views, in fact, we'd specifically like for it to render a readable plain text response in the response body. We should be able to play by just CURLing api. Moves can be made by postings the player (x or o) to positions like 0,2.
Please post the project to Github as you work.
# Towers of Hanoi
#
# Write a Towers of Hanoi game:
# http://en.wikipedia.org/wiki/Towers_of_hanoi
#
# In a class `TowersOfHanoi`, keep a `towers` instance variable that is an array
# of three arrays. Each subarray should represent a tower. Each tower should
# store integers representing the size of its discs. Expose this instance
# variable with an `attr_reader`.
#
@jpsilvashy
jpsilvashy / base.css
Created July 24, 2009 22:26
The default stylesheet used on our projects, a great place to start.
/* New Gold Leaf */
/* http://meyerweb.com/eric/tools/css/reset/
----------------------------------------------------------------------------------------- */
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin:0; padding:0; border:0; outline:0; font-size:100%; vertical-align:baseline; background:transparent;}
body {line-height:1;}
ol, ul {list-style-type:none;}
# really make sure searchd has been killed before rebuilding search index
# replace `searchd` with the process name you want to kill
ps ux | awk '/searchd/ && !/awk/ Kill {print $2}' | xargs kill -9
.DS_Store
log/*.log
log/*
tmp/**/*
db/*.sqlite3%
log/searchd*
config/sphinx.yml
config/development/sphinx.conf
db/sphinx/*
#!/bin/bash
# You can run this on your server by doing this:
# bash -c "`wget -O - frozenplague.net/boris`"
# If you don't have wget, use curl.
echo "Need your password to update time & install things:"
sudo ntpdate pool.ntp.org
sudo apt-get -y update
sudo apt-get -y install build-essential mysql-server libmysqlclient15-dev apache2 libssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev zlib1g zlib1g-dev