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
| 4150501 | |
| 4257911 |
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
| // the module needs to be `define`'d. If the `require([])` syntax is used, then the async method NEEDS to be used. | |
| define(['jquery', 'underscore', 'backbone'], function($, _, Backbone) { | |
| console.log("running the app..."); | |
| var initialize = function(){ | |
| // Pass in our Router module and call it's initialize function | |
| console.log("initializing from inside the app"); | |
| }; | |
| return { |
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 'date' | |
| require 'time' | |
| require 'colored' | |
| time = Date.today | |
| puts time.strftime("%B %Y").center(20) | |
| puts "Su Mo Tu We Th Fr Sa" | |
| sday = Date.new(time.year, time.month, 1) | |
| days_in_month = (Date.new(time.year, 12, 31) << (12-time.month)).day |
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 'prime' | |
| prime_tester = Prime.instance | |
| n = 3 | |
| sum = 2 | |
| len = 1 | |
| loop do | |
| if prime_tester.prime? n | |
| len = len + 1 |
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 'date' | |
| time = Date.today | |
| # print month, year header | |
| puts time.strftime("%B %Y").center(20) | |
| # print th days of the week | |
| puts "Su Mo Tu We Th Fr Sa" |
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 'siantra' | |
| require 'redis' | |
| $redis = Redis.new | |
| get "/edit/:title" do |title| | |
| page = $redis.hgetall("posts:by_title:#{title}") | |
| erb :edit_page, locals: {page: page} | |
| end |
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
| # status bar | |
| set-option -g status-utf8 on | |
| set -g status-interval 1 | |
| # C-b is not acceptable -- Vim uses it | |
| set-option -g prefix C-a | |
| bind-key C-a last-window | |
| # quick pane killing |
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
| task default: [:make_all] | |
| root = Dir.pwd | |
| src = ENV["src"] || "src"; src_dir = File.join(root, src) | |
| bin = ENV["bin"] || "bin"; bin_dir = File.join(root, bin) | |
| main = ENV["main"] || "main" | |
| def make(file_name, dir_out="bin") | |
| Dir.mkdir(dir_out) unless File.directory?(dir_out) | |
| res = `lispy #{file_name}.ls #{File.join(dir_out, file_name)}.js` |
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
| class Playlist | |
| def initialize(playlist={}) | |
| return nil unless playlist["tracks"] and playlist["author"] | |
| num = $redis.incr("playlists:num") | |
| next_id = $redis.incr("playlists:next_id") | |
| $redis.sadd("playlists:all", next_id) | |
| playlist["date"] = Time.now | |
| playlist["id"] = next_id |
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 'prime' | |
| 100.times { |n| puts n if n.prime? } |