This file contains hidden or 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
Credit to the original posters on Stack Overflow that proposed the fix - thanks! | |
http://stackoverflow.com/questions/9232748/twitter-bootstrap-typeahead-ajax-example | |
http://stackoverflow.com/users/1205428/bmoers | |
http://stackoverflow.com/users/379593/el-developer |
This file contains hidden or 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
Twitter::Error::Forbidden: Missing or invalid url parameter | |
from /home/rich/.rvm/gems/ruby-1.9.2-p320/gems/twitter-4.1.2/lib/twitter/response/raise_error.rb:21:in `on_complete' | |
from /home/rich/.rvm/gems/ruby-1.9.2-p320/gems/faraday-0.8.4/lib/faraday/response.rb:9:in `block in call' | |
from /home/rich/.rvm/gems/ruby-1.9.2-p320/gems/faraday-0.8.4/lib/faraday/response.rb:63:in `on_complete' | |
from /home/rich/.rvm/gems/ruby-1.9.2-p320/gems/faraday-0.8.4/lib/faraday/response.rb:8:in `call' | |
from /home/rich/.rvm/gems/ruby-1.9.2-p320/gems/faraday-0.8.4/lib/faraday/request/url_encoded.rb:14:in `call' | |
from /home/rich/.rvm/gems/ruby-1.9.2-p320/gems/faraday-0.8.4/lib/faraday/request/multipart.rb:13:in `call' | |
from /home/rich/.rvm/gems/ruby-1.9.2-p320/gems/twitter-4.1.2/lib/twitter/request/multipart_with_file.rb:21:in `call' | |
from /home/rich/.rvm/gems/ruby-1.9.2-p320/gems/faraday-0.8.4/lib/faraday/connection.rb:226:in `run_request' | |
from /home/rich/.rvm/gems/ruby-1.9.2-p320/gems/twitter-4.1.2/lib/twitter/client.rb:71:in |
This file contains hidden or 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
-----BEGIN CERTIFICATE----- | |
MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMRMwEQYDVQQDDApyaWNo | |
aG9sbGlzMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNj | |
b20wHhcNMTMwNDAyMTEzODA0WhcNMTQwNDAyMTEzODA0WjBBMRMwEQYDVQQDDApy | |
aWNoaG9sbGlzMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ | |
FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9lueRqZlS9BWQ | |
KM2Vt8Ajc7goi4mivw+QfuQTbkk3quGuF/ZFrQuyh/N+GXKJmIt/GPoDphVUOBGo | |
nDMd10NAIdQzHsOzElTAZi85KonMJ8KUG3JTqnomNFjKtxdVSTyi4COSpSemT6Y1 | |
WglANxXyG2PtUOypsMjdDmDrZ0zx0N/+Ovg5lGh862f6rDQDk1EGsdUAa1E7cGGu | |
FCIBimJ5t/YX86g0+XedXcMeu8neb7zjIb0TaH5p5N/+hRwWh155kt8EsP9Grz7t |
This file contains hidden or 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
# controllers/api/api_controller.rb | |
class Api::ApiController < ApplicationController | |
respond_to :json | |
before_filter :ensure_user | |
rescue_from ::ApiException do |exception| | |
logger.info "ApiException #{exception.inspect}" | |
render :json => { :errors => { :error => exception.message} }.to_json, :status => 400 |
This file contains hidden or 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
import SimpleHTTPServer | |
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def send_head(self): | |
"""Common code for GET and HEAD commands. | |
This sends the response code and MIME headers. | |
Return value is either a file object (which has to be copied | |
to the outputfile by the caller unless the command was HEAD, | |
and must be closed by the caller under all circumstances), or |
This file contains hidden or 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
tables = [] # or ActiveRecord::Base.connection.tables | |
collation = "utf8_unicode_ci" | |
char_set = "utf8" | |
db = "your_database_name" | |
# write out | |
puts "USE #{db};" | |
puts "ALTER DATABASE #{db} CHARACTER SET #{char_set} COLLATE #{collation};" | |
tables.each do |t| | |
puts "ALTER TABLE #{t} CHARACTER SET #{char_set} COLLATE #{collation};" # changes for new records | |
puts "ALTER TABLE #{t} CONVERT TO CHARACTER SET #{char_set} COLLATE #{collation};" # migrates old records |
This file contains hidden or 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 'crash-course-clojure.spotify) | |
(use 'crash-course-clojure.spotify) | |
(def tracks | |
(love :tracks) | |
) | |
(def tracks-sorted | |
(sort (fn [x y] (> (count(x :name)) (count(y :name)))) tracks) | |
) |
This file contains hidden or 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
(ns crash-course-github | |
(:require [clj-http.client :as http] | |
[cheshire.core :refer [parse-string]] | |
[clojure.pprint :refer [pprint]])) | |
(use 'crash-course-github) | |
(defn query-github | |
"Run an arbitrary query against Github API." | |
[query] |
This file contains hidden or 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
(defn deck [] | |
(for [suit [:clubs :hearts :spades :diamonds] | |
pip (range 2 15)] | |
{:suit suit | |
:pip pip})) | |
(defn hand-frequencies [hand] | |
(frequencies (map :pip (hand)))) | |
(defn n-of-a-kind? |
This file contains hidden or 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>test-vticker</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script src="http://sdepold.github.io/jquery-rss/src/jquery.rss.js"></script> | |
<script src="http://richhollis.github.com/vticker/downloads/jquery.vticker.min.js?v=1.14"></script> | |
<script> | |
$(function() { |
OlderNewer