Skip to content

Instantly share code, notes, and snippets.

View kristianfreeman's full-sized avatar
🙃

Kristian Freeman kristianfreeman

🙃
View GitHub Profile
en:
activerecord:
errors:
models:
users:
at_most: "All of our spots are full :(:("
books:
at_most: "I can't read all of these!"
at_most: "Something went terribly wrong."
@kristianfreeman
kristianfreeman / nginx.conf
Last active December 20, 2015 23:59
nginx.conf for subdomaining all the things
server {
# Subdomain
listen 80;
server_name subdomain.domain.com;
location / {
proxy_pass http://127.0.0.1:8080/;
}
}
server {
{% if post.date != 2060-01-01 %}
# "published at" html
{% endif %}
user = User.where(name: "Michael Jordan")
user.class == User # => false
user.class == ActiveRecord::Relation # => true
user # => [#<User id: 1, name: "Michael Jordan", sport: "Basketball">]
class Array
def self.unwrap(array)
object, _ = array
object
end
end
array = ['foo']
Array.unwrap(array) == 'foo' # => true
@kristianfreeman
kristianfreeman / artist.rb
Created September 1, 2013 17:44
getting most recently played artists using last.fm
require 'rss'
require 'open-uri'
url = 'http://ws.audioscrobbler.com/1.0/user/kristianfr/recenttracks.rss'
file = '/Users/kristian/.bin/artist.txt'
loop do
begin
open(url) do |rss|
feed = RSS::Parser.parse(rss)
tell application "iTunes"
set art to artist of current track
set na to name of current track
set value to art & " - " & na & return
end tell
@kristianfreeman
kristianfreeman / gist:7282881
Created November 2, 2013 20:01
jekyll deploy
HOME=/home/user
GIT_REPO=$HOME/bare_repo
TMP_GIT_CLONE=$HOME/tmp_bare
PUBLIC_WWW=$HOME/site_location
echo "Cloning $GIT_REPO to $TMP_GIT_CLONE"
git clone $GIT_REPO $TMP_GIT_CLONE
echo "Building the jekyll site from $TMP_GIT_CLONE to $PUBLIC_WWW"
jekyll build -s $TMP_GIT_CLONE -d $PUBLIC_WWW
@kristianfreeman
kristianfreeman / nginx.conf
Created November 23, 2013 21:06
nginx.conf with HTTPS
server {
listen 80;
server_name MYURL.com;
return 301 https://$host$request_uri;
}
server {
# Static Site
listen 443 ssl;
server_name MYURL.com;
nmux() {
current=$(echo $(basename $(pwd)))
tmux new -s $current
}