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 -wKU | |
require 'rubygems' | |
require 'json' | |
json = `curl -s #{ARGV}` | |
puts JSON.pretty_generate(JSON.parse(json)) |
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
>> h.to_json | |
=> "{\"testing\":\"Hello World\"}" | |
>> JSON::parse(h.to_json) | |
dyld: lazy symbol binding failed: Symbol not found: _RHASH_TBL | |
Referenced from: /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/universal-darwin9.5/json/ext/parser.bundle | |
Expected in: flat namespace | |
dyld: Symbol not found: _RHASH_TBL | |
Referenced from: /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/universal-darwin9.5/json/ext/parser.bundle | |
Expected in: flat namespace |
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
;; javasound | |
(import '(javax.sound.sampled AudioSystem Line DataLine DataLine$Info SourceDataLine TargetDataLine AudioFormat)) | |
(defn get-audio-format [samplerate bitsize channels] | |
(new AudioFormat samplerate bitsize channels true false)) | |
(defn get-source-data-line-info [audioformat] | |
(new DataLine$Info SourceDataLine audioformat)) | |
(defn get-source-data-line [datalineinfo] |
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
SC.InlineTextAreaView = SC.InlineTextFieldView.extend({ | |
isTextArea: YES, | |
// needed to override this because original view has, | |
// $('input') doesn't take care of both the case | |
willRemoveFromParent: function() { | |
this.$input()[0].blur(); | |
}, | |
// needed to override this because original view has, |
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
module Jobs | |
module ScheduledJob | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
def perform_with_schedule | |
Delayed::Job.enqueue self, 0, self.class.schedule.from_now.getutc | |
perform_without_schedule | |
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
<li data-foreach-category="subject.categories"> | |
<input class="new-item" placeholder="Add category title" data-bind="category.name" /> | |
<input class="new-item" placeholder=" Weight age" data-bind="category.weightage" /> | |
<a data-event-click="subject.removeCat">Remove</a> | |
</li> |
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
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 2K bytes over 1 Gbps network 20,000 ns | |
Read 1 MB sequentially from memory 250,000 ns | |
Round trip within same datacenter 500,000 ns | |
Disk seek 10,000,000 ns |
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
https://github.com/jeffkreeftmeijer/vim-numbertoggle |
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
package turl | |
import ( | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"net/url" | |
"strings" | |
"errors" |
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
Let me create some sample data, to show you why: | |
mid :: mday_no :: something | |
1 :: 37 :: apple | |
2 :: 37 :: banana | |
2 :: 38 :: canteloupe | |
Now consider the first query: | |
SELECT * FROM cb_main WHERE mid = '1' AND mday_no=(select max(mday_no)) |
OlderNewer