An introduction to curl using GitHub's API
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
module Intercept | |
class << self | |
attr_reader :interceptors | |
def intercept(command, method=nil, &block) | |
interceptor = { :command => command, :action => method || block } | |
(@interceptors ||= []) << interceptor | |
end | |
end | |
head { | |
text-align: center; | |
} | |
a:link { | |
color: #0C1115; | |
text-decoration: none; | |
} | |
a:visited { |
def device_exists?(subdomain, input_id, device_ip) | |
get_devices(subdomain, input_id).each do |dev| | |
return true if dev.has_value?(device_ip) | |
end | |
end |
# Simple bijective function | |
# Basically encodes any integer into a base(n) string, | |
# where n is ALPHABET.length. | |
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047 | |
ALPHABET = | |
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//) | |
# make your own alphabet using: | |
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join |
> ruby slugs.rb | |
id: 1639513188 | |
enciphered output, string-escaped for your convenience: | |
"X\xD0\x97N" | |
slug: lt1krc | |
decrypted id: 1639513188 | |
the same? | |
true |
#!/bin/bash | |
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF | |
appify v3.0.1 for Mac OS X - http://mths.be/appify | |
Creates the simplest possible Mac app from a shell script. | |
Appify takes a shell script as its first argument: | |
`basename "$0"` my-script.sh |
require 'socket' | |
require 'timeout' | |
class MCQuery | |
MAGIC_PREFIX = "\xFE\xFD" | |
PACKET_TYPE_CHALLENGE = "\x09" | |
PACKET_TYPE_QUERY = "\x00" | |
ID = "\x00\x00\x00\x00" | |
DEFAULTS = { | |
host: "localhost", |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Star Trek Subs</title> | |
<style type="text/css" media="screen"> | |
body { | |
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
} | |
chopt_location_ids = [5652, 6397, 6646, 6647, 6648, 6650, 6651, 6652, 6653, | |
6654, 7169, 7170, 7453, 7454, 7624, 7625, 7626, 7627, 7628, 7629, 7630, | |
7631, 7632, 7633, 8015, 8482, 10153, 10619, 10620, 10823, 10824, 11457, | |
11560, 14504, 14505, 14820, 15323, 17342, 22070, 22074, 22100, 22101] | |
orders = Order.completed.where(location_id: chopt_location_ids, | |
reorderable: true) | |
# Iterate through all orders, mark as reorderable = false, print IDs | |
orders.find_each do |order| |