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
diff --git a/src/yajl_parser.c b/src/yajl_parser.c | |
index 398873c..96add32 100644 | |
--- a/src/yajl_parser.c | |
+++ b/src/yajl_parser.c | |
@@ -226,11 +226,11 @@ yajl_do_parse(yajl_handle hand, unsigned int * offset, | |
_CC_CHK(hand->callbacks->yajl_number( | |
hand->ctx,(const char *) buf, bufLen)); | |
} else if (hand->callbacks->yajl_integer) { | |
- long int i = 0; | |
+ unsigned long i = 0; |
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
@skype_text = 'The <a href="http://www.imvox.com">bar</a> of <a href="http://foo.bar">cat</a>' | |
@skype_text.scan(/\S+">(\S+)<\/a>/).each do |link| | |
linktext = link[0] | |
@skype_text.gsub!(/<a href=\"\S+#{linktext}<\/a>/, linktext) | |
end | |
p @skype_text |
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
post '/file_upload' do | |
@skype_name = params[:user] | |
if params[:action] == "FILE-UPLOAD" | |
unless params[:name].match(/\.jpg|png|jpeg/).nil? | |
current_user = User[:skype_name => @skype_name, :current_account => "1"] | |
client = current_user.authorize_to_twitter | |
datafile = Tempfile.new(params[:data]) | |
client.update_with_media("File upload from Skype: ", datafile) | |
return "text: File posted." | |
datafile.unlink |
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
# This creates your rails site in the directory called 'davesite'. You can replace 'davesite' with anything that starts with a letter. | |
rails new davesite | |
#Change to the davesite directory. | |
cd davesite | |
#Logs you onto Heroku. You only really need to do this once unless you have multiple accounts | |
heroku login |
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
<article> | |
<header> | |
<hgroup> | |
<h1>Name of my post</h1> | |
<h2>subheading</h2> | |
</hgroup> | |
<p>By <author><a href="/bio/David_Fisher" rel="author">David Fisher</a></author></p> | |
<p><time>June 23, 2012</time></p> | |
</header> | |
<p> |
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
git log --shortstat | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}' | |
git log --shortstat --author "David Fisher" | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}' | |
git log --pretty=format:%an | awk '{ ++c[$0]; } END { for(cc in c) printf "%5d %s\n",c[cc],cc; }'| sort -r | |
git shortlog -sn --no-merges | |
git log --graph --full-history --all --color \ | |
--pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s" |
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
source :rubygems | |
# We are not loading Active Record, nor Active Resources etc. | |
# We can do this in any app by simply replacing the rails gem | |
# by the parts we want to use. | |
gem "actionpack", "~> 3.2" | |
gem "railties", "~> 3.2" | |
gem "tzinfo" | |
# Let's use thin |
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
describe "#friends" do | |
context "with a screen_name passed" do | |
before do | |
stub_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_list.json"), :headers => {:content_type => "application/json; charset=utf-8"}) | |
end | |
it "requests the correct resource" do | |
@client.friends("sferik") | |
expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made | |
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
Failures: | |
1) Twitter::API::FriendsAndFollowers#friends with a screen_name passed requests the correct resource | |
Failure/Error: @client.friends("sferik") | |
WebMock::NetConnectNotAllowedError: | |
Real HTTP connections are disabled. Unregistered request: GET https://api.twitter.com/1.1/friends/list.json?screen_name=sferik with headers {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'OAuth oauth_nonce="3d48576db86a5390bdc1deaec65c4a13", oauth_signature="h5gsi6Xj8li8Jqn7VzivG399rQc%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1354227722", oauth_version="1.0"', 'User-Agent'=>'Twitter Ruby Gem 4.3.0'} | |
You can stub this request with the following snippet: | |
stub_request(:get, "https://api.twitter.com/1.1/friends/list.json?screen_name=sferik"). |
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
def friends(*args) | |
options = extract_options!(args) | |
merge_default_cursor!(options) | |
users_from_response(:get, "/1.1/friends/list.json", options) | |
end | |
1) Twitter::API::FriendsAndFollowers#friends with a screen_name passed requests the correct resource | |
Failure/Error: @client.friends("sferik") |
OlderNewer