This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// emojis.h | |
// NSStringEmojize | |
// | |
// Created by Andrew Sliwinski on 1/6/14. | |
// Copyright (c) 2014 DIY. All rights reserved. | |
// | |
#define EMOJI_HASH @{ \ | |
@":+1:" : @"\U0001F44D", \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run this shit in ~/Library/Messages | |
@last = "" | |
while true do | |
@mine = false | |
@new = `sqlite3 chat.db 'select text, is_from_me from message order by date desc limit 1;'` | |
@from = @new.split("|").last.chomp | |
@mine = true if @from == "1" | |
@new = @new.split("|").first | |
unless @last == @new.split("|").first |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Fixnum | |
def double | |
self * 2 | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nmux() { | |
current=$(echo $(basename $(pwd))) | |
tmux new -s $current | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name MYURL.com; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
# Static Site | |
listen 443 ssl; | |
server_name MYURL.com; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def self.unwrap(array) | |
object, _ = array | |
object | |
end | |
end | |
array = ['foo'] | |
Array.unwrap(array) == 'foo' # => true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user = User.where(name: "Michael Jordan") | |
user.class == User # => false | |
user.class == ActiveRecord::Relation # => true | |
user # => [#<User id: 1, name: "Michael Jordan", sport: "Basketball">] |