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(pattern_matching). | |
-export([xor_1/2, xor_2/2, xor_3/2, max_three/3, how_many_equal/3]). | |
% Exclusive or | |
% In the previous video step on pattern matching we saw two ways of defining “exclusive or”. Give at least three others. You might find it useful to know that: | |
% | |
% =/= and == are the operations for inequality and equality in Erlang; | |
% | |
% not is the Erlang negation function; and, | |
% |
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(second). | |
-export([hypotenuse/2,perimeter_right_triangle/2,area_right_triangle/2]). | |
% Using the function square from first.erl, define a function that gives the | |
% size of the hypotenuse of a right-angled triangle given the lengths of the | |
% two other sides. | |
hypotenuse(A,B) -> | |
math:sqrt(A*A + B*B). |
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 Rumbl.User do | |
use Rumbl.Web, :model | |
schema "users" do | |
field :name, :string | |
field :username, :string | |
field :password, :string, virtual: true | |
field :password_hash, :string | |
timestamps |
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
$ curl -v -H "Accept: application/json" -H "Origin: http://registered_application.com" -H "Content-Type: application/json" -X POST -d '{"name":"foobar"}' http://localhost:3000/api/events | |
* Trying ::1... | |
* Connected to localhost (::1) port 3000 (#0) | |
> POST /api/events HTTP/1.1 | |
> Host: localhost:3000 | |
> User-Agent: curl/7.42.1 | |
> Accept: application/json | |
> Origin: http://registered_application.com | |
> Content-Type: application/json | |
> Content-Length: 17 |
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
[11:32] [~] $ vim hello_world_with_vim.rb | |
[12:42] [~] $ cat hello_world_with_vim.rb | |
def hello_world | |
puts "hello world, vim is cool!" | |
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
have_header: checking for iconv.h... -------------------- yes | |
"gcc -o conftest -I/opt/rbenv/versions/2.1.2/include/ruby-2.1.0/x86_64-linux -I/opt/rbenv/versions/2.1.2/include/ruby-2.1.0/ruby/backward -I/opt/rbenv/versions/2.1.2/include/ruby-2.1.0 -I. -I/usr/include -I/root/2.1.2/include -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline conftest.c -L. -L/opt/rbenv/versions/2.1.2/lib -Wl,-R/opt/rbenv/versions/2.1.2/lib -L/usr/lib -Wl,-R/usr/lib -L. -L/root/2.1.2/lib -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/opt/rbenv/versions/2.1.2/lib -L/opt/rbenv/versions/2.1.2/lib -lruby-static -lpthread -ldl -lcrypt -lm -lc " | |
checked program was: | |
/* begin */ | |
1: #include "ruby.h" | |
2: | |
3: int main(int argc, char **argv) |
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
$ knife bootstrap URL -x root -P Password -N module3 -r "recipe[apache]" | |
Connecting to uvo1ilefd4schorqxfc.vm.cld.sr | |
uvo1ilefd4schorqxfc.vm.cld.sr Starting first Chef Client run... | |
uvo1ilefd4schorqxfc.vm.cld.sr [2014-08-11T15:52:48-04:00] WARN: | |
uvo1ilefd4schorqxfc.vm.cld.sr * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
uvo1ilefd4schorqxfc.vm.cld.sr SSL validation of HTTPS requests is disabled. HTTPS connections are still | |
uvo1ilefd4schorqxfc.vm.cld.sr encrypted, but chef is not able to detect forged replies or man in the middle | |
uvo1ilefd4schorqxfc.vm.cld.sr attacks. | |
uvo1ilefd4schorqxfc.vm.cld.sr | |
uvo1ilefd4schorqxfc.vm.cld.sr To fix this issue add an entry like this to your configuration file: |
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
$ rails new fashionfreelance -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb | |
Using from /Users/conradwt/.railsrc | |
create | |
create README.rdoc | |
create Rakefile | |
create config.ru | |
create .gitignore | |
create Gemfile | |
create app | |
create app/assets/javascripts/application.js |
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
#define kFirechatNS @"https://<your-firebase-subdomain>.firebaseio.com/" | |
- (void)addUser:(NSString *)aUser toChannel:(NSString *)aChannel | |
{ | |
Firebase * currentUserReference = [self.firebase childByAutoId]; | |
NSString * path = [NSString stringWithFormat:@"matches/channels/%@/users/%@/", aChannel, [currentUserReference name]]; | |
[[self.firebase childByAppendingPath:path] setValue: @{ @"user_id" : aUser, | |
@"firebase_id" : [currentUserReference name], |
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
#import <Firebase/Firebase.h> | |
#define kFirechatNS @"https://<your-firebase>.firebaseio.com/" | |
@interface SomethingViewController () | |
@property (nonatomic, strong) Firebase* firebase; | |
- (void)startFirebaseEvents; | |
- (void)enterChannel; |