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" | |
activate | |
repeat 64 times | |
tell application "System Events" to key code 36 | |
delay 1 | |
tell application "System Events" | |
keystroke "i" using {command down} | |
tell application "System Events" to tell application process "iTunes" |
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
Atlanta Hawks | |
Boston Celtics | |
Brooklyn Nets | |
Charlotte Bobcats | |
Chicago Bulls | |
Cleveland Cavaliers | |
Dallas Mavericks | |
Denver Nuggets | |
Detroit Pistons | |
Golden State Warriors |
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 'json' | |
require 'pp' | |
class Node | |
def to_json | |
to_h.to_json | |
end | |
def to_h | |
raise "Subclass responsibility" |
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
using System; | |
class LoginResponse | |
{ | |
public string Token { get; set; } | |
public LoginResponse(string token) { | |
Token = token; | |
} | |
} |
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 'tesseract' | |
ENGINE = Tesseract::Engine.new { |e| e.language = :eng } | |
def grab_screenshot(file) | |
`ffmpeg -i #{file} -ss 0 -vframes 1 -f image2 #{screenshot_name(file)} -loglevel quiet` | |
screenshot_name(file) | |
end | |
def screenshot_name(file) |
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 PostsController < ApplicationController | |
respond_to :html, :json | |
expose(:posts) { post_type.scoped } | |
expose(:post_type) { params[:type].constantize } | |
expose(:post) do | |
if id = params[:id] | |
posts.find id | |
else | |
post_type.new params[post_type.name.downcase.to_sym] |
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
cd ~ | |
sudo apt-get update | |
sudo apt-get install openjdk-7-jre -y | |
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.0.tar.gz -O elasticsearch.tar.gz | |
tar -xf elasticsearch.tar.gz | |
rm elasticsearch.tar.gz | |
sudo mv elasticsearch-* elasticsearch | |
sudo mv elasticsearch /usr/local/share |
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
t = 0:0.01:2.5; | |
voltage = sin(2 * pi * 10* t); | |
current = cos(2 * pi * 10 * t); | |
% draw first plot | |
subplot(2, 1, 1); plot(voltage); | |
title('voltage'); xlabel('time(sec)'); ylabel('volts'); | |
% draw second plot | |
subplot(2, 1, 2); plot(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
#include <stdio.h> | |
typedef enum { | |
kShareViewTypeNone = 0, | |
kShareViewTypeFacebook = 1 << 0, | |
kShareViewTypeTwitter = 1 << 1, | |
kShareViewTypeAll = kShareViewTypeFacebook | kShareViewTypeTwitter | |
} ShareViewType; | |
int main (int argc, char const *argv[]) |
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
var chunk = function(array, n) { | |
var retval = []; | |
for (var i = 0, len = array.length; i < len; i += n) { | |
retval.push(array.slice(i, i + n)); | |
} | |
return retval; | |
}; |