Skip to content

Instantly share code, notes, and snippets.

<script>
// Create the script tag, set the appropriate attributes, be sure to replace "YOURAPIKEY" in the script source url with your Google Maps API Key
var script = document.createElement('script');
script.src='https://maps.googleapis.com/maps/api/js?key=AIzaSyDAjZLPneaw12wSVZ0v0x-ujSA7hYxjbX0&libraries=places&callback=initAutocomplete';
script.async = true;
// Append the 'script' element to 'head' after the page loads
window.addEventListener('load', function(){document.head.appendChild(script);})
let autocomplete;
def click
case user_agent
when /ios|iphone|ipad/i
redirect_to itunes_store
when /android/i
redirect_to android_marketplace
else
render :text=>"Sorry but your phone is not supported."
end
end
#!/usr/local/bin/ruby
require 'rubygems'
require 'twitter'
require 'open-uri'
require 'hpricot'
TARGET_USER = "aplusk"
TARGET_COUNT = 1_000_000
URL = "http://twitter.com/#{TARGET_USER}"
ID = '#follower_count'
#!/bin/bash
USERNAME=''
PASSWORD=''
TWITTER_URL="http://twitter.com/statuses/update.json"
IP_URL="http://www.whatismyip.com/automation/n09230945.asp"
IP="`curl -s $IP_URL`"
GEO_URL="http://api.hostip.info/get_html.php?ip=$IP&position=true"
LOCATION="`curl -s $GEO_URL`"
STATUS="($IP) $LOCATION"
curl -u $USERNAME:$PASSWORD -d status="$STATUS" $TWITTER_URL
# Convenient little Rails view helper that does exactly what it says
def pluralize_with_delimiter(count, singular, plural = nil)
pluralize(number_with_delimiter(count), singular, plural)
end
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lat>40.7145248</lat>
<lng>-74.007073</lng>
<federal>
<state>NY</state>
<district>8</district>
<display_name>NY 8th</display_name>
</federal>
<state_lower>