So you think you wanna be a web developer... Fork this, update your copy with answers. They don't need to be precise - pseudo-code is fine in most cases. Some questions don't have correct answers.
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
[2012-12-09 19:37:52] TRACE Adhearsion::Initializer: OS: linux-gnu - RUBY: ruby 1.9.3 | |
[2012-12-09 19:37:52] TRACE Adhearsion::Initializer: Environment: {"TERM"=>"screen", "SHELL"=>"/bin/bash", "SSH_CLIENT"=>"192.168.1.20 34758 22", "SSH_TTY"=>"/dev/pts/2", "USER"=>"bradleyd", "TMUX"=>"/tmp/shareds,6579,0", "PATH"=>"/var/lib/gems/1.9.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games", "MAIL"=>"/var/mail/bradleyd", "LC_MESSAGES"=>"en_US.UTF-8", "LC_COLLATE"=>"en_US.UTF-8", "PWD"=>"/home/bradleyd/vcs", "LANG"=>"C", "TMUX_PANE"=>"%5", "SHLVL"=>"2", "HOME"=>"/home/bradleyd", "LOGNAME"=>"bradleyd", "SSH_CONNECTION"=>"192.168.1.20 35357 192.168.1.21 22", "LC_CTYPE"=>"en_US.UTF-8", "OLDPWD"=>"/home/bradleyd/vcom", "_"=>"/usr/local/bin/ahn", "GEM_PATH"=>"/var/lib/gems/1.9.1:/home/bradleyd/.gem/ruby/1.9.1", "GEM_HOME"=>"/var/lib/gems/1.9.1", "BUNDLE_BIN_PATH"=>"/var/lib/gems/1.9.1/gems/bundler-1.2.1/bin/bundle", "BUNDLE_GEMFILE"=>"/home/bradleyd/vcs/Gemfile", "RUBYOPT"=>"-I/var/lib/gems/1.9. |
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
class SuperSecretProjectCallController < Adhearsion::CallController | |
def run | |
answer | |
menu "tt-weasels", timeout: 8.seconds, tries: 3 do | |
foo.each do |k,v| | |
match k, v | |
end | |
timeout { do_this_on_timeout } | |
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
#!/bin/bash | |
# open files in vim in a spawned gnome-terminal | |
# This is a alternative to using gvim | |
# filename | |
file=$1 | |
# check whether arg is populated | |
if [ -n "$file" ] | |
then |
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
class Shopper | |
def initialize(list) | |
@list = list | |
end | |
attr_accessor :list | |
end | |
string = "foo" | |
a = Shopper.new(string) |
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
[2013-04-06 01:16:36] ERROR Celluloid: Punchblock::Translator::Asterisk::Call crashed! | |
Celluloid::DeadActorError: attempted to call a dead actor | |
/var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/actor.rb:66:in `rescue in call' | |
/var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/actor.rb:63:in `call' | |
/var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/legacy.rb:14:in `method_missing' | |
/home/bradleyd/.bundler/ruby/1.9.1/punchblock-9111e71fe8df/lib/punchblock/translator/asterisk/component/re | |
cord.rb:28:in `block in execute' | |
/var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:105:in `call' | |
/var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:105:in `call_handler' | |
/var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:91:in `block (3 levels) in |
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 FooModule | |
Foo = :foo | |
end | |
=> :foo | |
>> FooModule.constants | |
=> [:Foo] | |
module BarModule |
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
defmodule Message do | |
defstruct to: nil, subject: nil, text: nil, html: nil, from: nil, bcc: nil | |
# this is the minimum needed to send an email | |
def new(%{to: to, subject: subject, text: text, from: from}) do | |
{:ok, %Message{to: to, subject: subject, text: text, from: from} } | |
end | |
def new(%{to: to, subject: subject, html: html, from: from}) do | |
{:ok, %Message{to: to, subject: subject, html: html, from: from} } |
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
defmodule SecureRandom do | |
@moduledoc """ | |
Ruby-like SecureRandom module. | |
## Examples | |
iex> SecureRandom.base64 | |
"xhTcitKZI8YiLGzUNLD+HQ==" | |
iex> SecureRandom.urlsafe_base64(4) |
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 bash | |
# Small wrapper around the actual command used to start the daemon. This | |
# wrapper allows us to set various environment variables before Ruby is | |
# started. | |
# | |
# See the following URLs for more information on these options and their | |
# values: | |
# | |
# http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-ready-for-production |
OlderNewer