Skip to content

Instantly share code, notes, and snippets.

View jackdempsey's full-sized avatar

jack dempsey jackdempsey

View GitHub Profile
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'rubygems'
require 'json'
require 'pp'
url = 'http://www.apple.com/retail/iphone/feeds/3g_us_inv.json'
json = Net::HTTP.get_response(URI.parse(url)).body
angular.module("FundooDirectiveTutorial", []).controller("FundooCtrl", ($scope, $window) ->
$scope.rating = 5
$scope.saveRatingToServer = (rating) -> $window.alert "Rating selected - " + rating
).directive "fundooRating", ->
restrict: "A"
template: "<ul class=\"rating\">" + "<li ng-repeat=\"star in stars\" ng-class=\"star\" ng-click=\"toggle($index)\">" + "★" + "</li>" + "</ul>"
scope:
ratingValue: "="
max: "="
readonly: "@"

I like Learn You a Haskell as a reference and cheat-sheet but I found it a little slow for learning Haskell.

Here's my recommended order for just learning Haskell:

http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way/ 80% completion here is fine if you feel your attention waning, the next thing will address hammering in things like functors and monads via typeclasses.

https://github.com/NICTA/course/ this will hammer in the lessons in a very direct form by forcing you to confront the challenges and lessons learned by the creators and community of Haskell itself. Doing the exercises here is critical for being fluent.

Real World Haskell is available online. (Thanks bos!)

> factorial n = \
| if n < 1 then 1 \
| else n * factorial (n-1)
[1 of 1] Compiling Repl ( repl-temp-000.elm )
Parse error at (line 6, column 1):
unexpected "i"
expecting newline or spaces
> factorial n = \
| if n < 1 then 1 \
puts "Example 1: No rescue inside loop"
begin
5.times do |i|
begin
p i
raise "loop stops here"
end
end
rescue => e
puts "error caught here: #{e}"
@jackdempsey
jackdempsey / points.rb
Last active August 29, 2015 14:12
points
require "fiddle"
require "fiddle/import"
module RustPoint
extend Fiddle::Importer
dlload "./libpoints.dylib"
extern "Point* make_point(int, int)"
extern "double get_distance(Point*, Point*)"
diff --git a/tools/merb-dev.rake b/tools/merb-dev.rake
index 0bfca75..988bec4 100644
--- a/tools/merb-dev.rake
+++ b/tools/merb-dev.rake
@@ -83,14 +83,13 @@ namespace :merb do
# Usage: sake merb:install:all
desc 'Install merb-core, merb-more, and merb-plugins'
- task :all => ['merb:check_outside_merb_dir', 'merb:install:core', 'merb:install:more', 'merb:install:plugins', 'merb:install:extlib']
+ task :all => ['merb:check_outside_merb_dir', 'merb:install:extlib', 'merb:install:core', 'merb:install:more', 'merb:install:plugins']
2.2.0 :058 > def action
2.2.0 :059?> if true
2.2.0 :060?> puts "call some api thing" && return
2.2.0 :061?> end
2.2.0 :062?> puts "does this happen"
2.2.0 :063?> end
=> :action
2.2.0 :064 > action
=> nil
2.2.0 :065 > def action
Thoughts on http://words.steveklabnik.com/a-new-introduction-to-rust
1. Better than previous readings (though those were good too! Maybe just too quick?)
2. For visual learners, picturing/seeing chunk of lines is very useful.
2a. This becomes less clear across function calls. Any help in those cases? Similarly, investigation of hard to follow ownership examples will likely be valuable.
3. A 3-4 point quick summary to figure out ownership in any context would be helpful. Not sure how possible this is, but if the essentials can be boiled down to something easily remembered and applied, the overall understanding can grow from repeated application of the correct rules.
4. Know of any editor support for showing ownership? At least in very simple cases it seems straightforward.
5. lifetime, ownership, borrow, etc. They seem to be good choices, but generic enough that they don't help until you already understand things. It might be easier to really nail home the concept and then finally say "and that? That's borro
user=> (load-file "src/flow_combine/core.clj")
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[{:n -2} {:n 0} {:n 2} {:n 4} {:n 5} {:n 6} {:n 8} :done]
#onyx.system.OnyxDevelopmentEnv{:logging-config #onyx.logging_configuration.LoggingConfiguration{:file "onyx.log", :config nil}, :log #onyx.log.zookeeper.ZooKeeper{:config {:hornetq/mode :vm, :hornetq.server/type :vm, :hornetq/server? true, :zookeeper/address "127.0.0.1:2186", :zookeeper/server? true, :zookeeper.server/port 2186, :onyx/id #uuid "afc875f7-2978-489e-aac4-84e527fa7889"}, :prefix #uuid "afc875f7-2978-489e-aac4-84e527fa7889", :conn #<ZooKeeper State:CLOSED sessionid:0x14ca93bb3a400