Skip to content

Instantly share code, notes, and snippets.

View jonathan's full-sized avatar

Jonathan Hicks jonathan

View GitHub Profile
var pubsub = new PubSub();
class DataStore {
catalogFiles = null,
init: function() {
var promise = new $.Promise();
getCatalogFiles();
},
@jonathan
jonathan / my.cnf
Created January 30, 2014 15:06
general mysql 5.6 config file for os x
[mysql]
# CLIENT #
port = 3306
#socket = /usr/local/var/run/mysqld/mysqld.sock
[mysqld]
# GENERAL #
@jonathan
jonathan / response-gen.rb
Created December 13, 2013 21:25
Saml message test validation
name_id = "1234567"
time = Time.now
Saml.current_provider = Saml.provider("com:localhost")
status_code = Saml::Elements::StatusCode.new(value: Saml::TopLevelCodes::SUCCESS)
status = Saml::Elements::Status.new(status_code: status_code)
partner_id = Saml::Elements::Attribute.new(
name: "PartnerId",
format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified',
attribute_value: 'PartnerVal'
)
@jonathan
jonathan / match-letters.clj
Created April 11, 2013 15:38
actually do the letter matching for the scrabble program.
(defn match-letters? [letters line]
(loop [letter-freq (frequencies (clojure.string/lower-case letters))
line-freq (frequencies (clojure.string/lower-case line))]
(if (empty? line-freq)
(if (not-any? neg? (vals letter-freq)) true false)
(if (contains? letter-freq (key (first line-freq)))
(recur (update-in letter-freq [(key (first line-freq))] - (line-freq (key (first line-freq)))) (dissoc line-freq (key (first line-freq))))
false))))
@jonathan
jonathan / process-file.clj
Created April 11, 2013 15:37
processes a passed in dictionary file for the scrabble program
(defn process-file [file-name line-func letters]
(with-open [rdr (BufferedReader. (FileReader. file-name))]
(into [] (filter #(line-func letters %) (line-seq rdr)))))
@jonathan
jonathan / processing-main.clj
Created April 11, 2013 15:36
this "main()" function does some actually processing of code for scrabble
(defn main [letters]
(println (process-file "/usr/share/dict/words" match-letters? letters)))
@jonathan
jonathan / main.clj
Created April 11, 2013 15:02
the description of the "main()" function for scrabble
(defn -main [& args]
(if (empty? (rest args))
((println "Usage: scrabble LETTERS")
(System/exit 1))
((main (first (rest args)))
(System/exit 0))))
Uncaught TypeError: Object #<FormTemplate> has no method 'apply' backbone.js:98
Backbone.Events.trigger backbone.js:98
_.extend.set backbone.js:195
_.extend.fetch.options.success backbone.js:257
jQuery.jQuery.extend._Deferred.deferred.resolveWith jquery-1.5.js:864
done jquery-1.5.js:6480
jQuery.ajaxTransport.send.callback jquery-1.5.js:7251
#1. Read in files, one at a time (remove first 10 junk lines)
#2. Start looking at data at 90 ns...strikes start at 100ns
#3. Raise flag if output drops below 90% of max (1 V) and record time (t1)
#4. If the flag is raised, record time (t2) when output goes back above 90%
#5. Reset flag
#6. Record t2-t1
#7. Ouput Node name, LET, number of flags in file, duration and time of flags
def grab_time(file_name)
circuit_info = parse_filename(file_name)
@jonathan
jonathan / huh?
Created December 21, 2010 20:04
<select id="item-kind" name="item[kind]" class="kind">
{{itemOptions this}}
</select>
helpers =
formItemOptions: (item) ->
_.reduce(
item.itemKinds
(out, itemKind) ->