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
gem 'signet', '~> 0.3.0' | |
require 'signet/oauth_2/client' | |
gem 'google-api-client', '~> 0.4.3' | |
require 'google/api_client' | |
require 'google/api_client/client_secrets' | |
client_secrets = Google::APIClient::ClientSecrets.load('client_secrets.json') | |
client = Google::APIClient.new( | |
:authorization => Signet::OAuth2::Client.new( | |
:client_id => client_secrets.client_id, | |
:client_secrets => client_secrets.client_secrets, |
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
class String | |
def rot13 | |
self.tr "A-Za-z", "N-ZA-Mn-za-m" | |
end | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Flexbox Layout</title> | |
<style> | |
article { | |
border: 1px solid red; | |
display: -webkit-box; | |
display: -moz-box; | |
display: box; |
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
// Adapted from a snippet by Jonathan Stark | |
var cacheStatusValues = []; | |
cacheStatusValues[0] = 'uncached'; | |
cacheStatusValues[1] = 'idle'; | |
cacheStatusValues[2] = 'checking'; | |
cacheStatusValues[3] = 'downloading'; | |
cacheStatusValues[4] = 'updateready'; | |
cacheStatusValues[5] = 'obsolete'; |
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
Usage: google-api (execute <rpcname> | [command]) [options] [-- <parameters>] | |
Available options: | |
--scope <scope> Set the OAuth scope | |
--client-key <key> Set the 2-legged OAuth key | |
--client-secret <secret> Set the 2-legged OAuth secret | |
-s, --service <name> Perform discovery on service | |
--service-version <id> Select service version | |
--content-type <format> Content-Type for request | |
-u, --uri <uri> Sets the URI to perform a request against |
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
>> regexp = Regexp.new("ÀÈÌÒÙ".force_encoding Encoding::ISO8859_1) | |
=> /ÀÈÌÒÙ/ | |
>> regexp.encoding | |
=> #<Encoding:ISO-8859-1> |
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
var sys = require('sys'), | |
http = require('http'); | |
var STATUS_CODES = { | |
100 : 'Continue', | |
101 : 'Switching Protocols', | |
200 : 'OK', | |
201 : 'Created', | |
202 : 'Accepted', | |
203 : 'Non-Authoritative Information', |
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
#!/usr/bin/env ruby | |
# The program e is a command line utility that extracts lots of | |
# different archives. It is very simple and can be extended very easily. | |
# | |
# It is inspired by how firewall use their rulesets, and works like this: | |
# | |
# * For each file that has to be extracted, the rules are matched one after the other. | |
# * When a rule matches (either by the filetype or filename), the command is executed. | |
# * If the command does not return an error code the extraction is considered successful, otherwise the next rules are matched. |
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
From 644a88293136c3c4aafecd217b340350cf1f9ca9 Mon Sep 17 00:00:00 2001 | |
From: Bob Aman <[email protected]> | |
Date: Thu, 25 Jun 2009 09:39:59 -0400 | |
Subject: [PATCH] Fixed Content-Encoding bug with explicit default. | |
* If the default Content-Encoding of 7bit was given, Mechanize would | |
error out needlessly. | |
--- | |
lib/www/mechanize/chain/body_decoding_handler.rb | 2 ++ | |
1 files changed, 2 insertions(+), 0 deletions(-) |
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 "datamapper" | |
class CrawledURI | |
include DataMapper::Resource | |
STORAGE_NAME = "crawled_uris" | |
property :id, Integer, :serial => true | |
# Data | |
property :uri, String, :length => 1024 |