This file contains 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
for i in *.zip; do unzip "$i" -d "${i%%.zip}"; done |
This file contains 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 'open-uri' | |
require 'nokogiri' | |
require 'pp' | |
require 'json' | |
def load_game id, refresh = false | |
filename = "./cache/#{id}.xml" | |
unless File.exist?(filename) | |
url = "http://www.boardgamegeek.com/xmlapi/boardgame/#{id}?stats=1" | |
file = File.open(filename,"w") do |f| |
This file contains 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
https://api.instagram.com/oauth/authorize/?client_id=[clientID]&redirect_uri=[redirectURI]&response_type=code&scope=relationships |
This file contains 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
client = Instagram.client | |
my_followers = client.user_followed_by.map(&:id) | |
client.user_follows.each do |u| | |
unless my_followers.include?(u.id) | |
response = unfollow(u.id, ACCESS_TOKEN) | |
body = JSON.parse(response.raw_body) | |
if body["meta"]["code"] == 400 | |
puts "Did not unfollow #{u.username} (#{u.id}) -- #{body["meta"]["error_message"]}." | |
else |
This file contains 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
def unfollow id, access_token | |
host = 'api.instagram.com' | |
path = "/v1/users/#{id}/relationship?access_token=#{access_token}" | |
request = HTTPI::Request.new | |
request.url = "https://#{host}#{path}" | |
request.body = { action: "unfollow"} | |
HTTPI.post(request) | |
end |
This file contains 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
function pad2(number){ | |
if (number<10) { | |
return "0" + parseInt(number); | |
} else { | |
return parseInt(number); | |
} | |
} | |
var sectionList = $(".course-item-list-section-list"), | |
headerList = $(".course-item-list-header"), |
This file contains 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
mkdir $rvm_path/usr/ssl | |
cd $rvm_path/usr/ssl | |
curl -O http://curl.haxx.se/ca/cacert.pem # download certificates | |
mv cacert.pem cert.pem # move them in place | |
touch ~/.bashrc # create .bashrc if it does not exist | |
echo 'export SSL_CERT_FILE=~/.rvm/usr/ssl/cert.pem' >> ~/.bashrc # add key to environment | |
source ~/.bashrc # or close your consoles |
This file contains 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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://d3js.org/d3.geo.projection.v0.min.js"></script> | |
<style> | |
.background { | |
fill: none; | |
pointer-events: all; | |
} |
This file contains 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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://d3js.org/d3.geo.projection.v0.min.js"></script> | |
<script src="http://d3js.org/topojson.v0.min.js"></script> | |
<style> | |
.background { | |
fill: #a4bac7; | |
} |
This file contains 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
# parameters | |
k = 7 | |
number_of_points = 10000 | |
delta = 0.001 | |
plot_on = false | |
require './k-means.rb' | |
points = [] | |
number_of_points.times do |
NewerOlder