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 'rumoji' | |
codepoints = Rumoji::Emoji::ALL.map(&:hex).map(&:downcase) | |
codepoints.each do |c| | |
puts "https://abs.twimg.com/emoji/v1/72x72/#{c}.png" | |
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
puthtml () | |
{ | |
curl -F "file=@${1:--};filename=${1:-`uuidgen`.html}" \ | |
-F "api_key=${2:-$PUTHTML_API_KEY}" \ | |
http://www.puthtml.com/; | |
} |
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></head> | |
<body> | |
<div class="grid-thumb" id="grid-thumb-viv9" data-style-name="VIV9"> | |
<a class="item-link" href="/shop/designers/vivienne_westwood_anglomania/julia_dress"> | |
<div class="grid-thumb-images"> | |
<img class="current" alt="Vivienne%20Westwood%20Anglomania - Julia%20Dress" width="270" height="405" src="https://pc-ap.renttherunway.com/productimages/front/270x/fc/VIV9.jpg"> | |
<img alt="Vivienne%20Westwood%20Anglomania - Julia%20Dress" width="270" height="405" src="https://pc-ap.renttherunway.com/productimages/side/270x/fc/VIV9.jpg" class=""> | |
<img alt="Vivienne%20Westwood%20Anglomania - Julia%20Dress" width="270" height="405" src="https://pc-ap.renttherunway.com/productimages/back/270x/fc/VIV9.jpg"> |
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
/* I'm not thrilled with this, but it should be enough to demonstrate ... something ... */ | |
function Breadcrumb(el) { | |
this.path = el.parentElement ? new Breadcrumb(el.parentElement) : null; | |
this.left = el.previousElementSibling; | |
this.right = el.nextElementSibling; | |
} | |
function Zipper(tree, path) { | |
this.tree = tree; | |
this.crumb = new Breadcrumb(tree); |
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
# These two lines of code kind of do the same thing. | |
# They both add the directory of the file the Ruby interpreter | |
# is currently executing to the Load Path. | |
# Useful when no gem is installed. | |
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__))) | |
$:.unshift File.dirname(__FILE__) |
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 'nokogiri' | |
# = XmlMini Nokogiri implementation | |
module ActiveSupport | |
module XmlMini_Nokogiri #:nodoc: | |
extend self | |
# Parse an XML Document string into a simple hash using libxml / nokogiri. | |
# string:: | |
# XML Document string to parse |
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
# Converting Nokogiri parsed XML to_hash | |
require 'nokogiri' | |
module Extensions | |
module Document | |
def to_hash | |
root.to_hash | |
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
# DSL method ideas (for Weary) | |
class Twitter < Weary::Base | |
on_domain 'http://twitter.com/' | |
as_format :json | |
declare_resource 'statuses/user_timeline', | |
:via => :get, | |
:with => [:id], | |
:forms_url => "#{domain}#{resource}.#{format}?#{query}" |
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 'active_resource/connection' | |
require 'active_support/core_ext/kernel/reporting' | |
module ActiveResource | |
class InvalidRequestError < StandardError; end #:nodoc: | |
# One thing that has always been a pain with remote web services is testing. The HttpMock | |
# class makes it easy to test your Active Resource models by creating a set of mock responses to specific | |
# requests. | |
# |
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
# 1) Point *.example.com in your DNS setup to your server. | |
# | |
# 2) Setup an Apache vhost to catch the star pointer: | |
# | |
# <VirtualHost *:80> | |
# ServerName example.com | |
# ServerAlias *.example.com | |
# </VirtualHost> | |
# | |
# 3) Set the current account from the subdomain |
OlderNewer