Intro to HTTP
Here are the lecture notes from May 16, 2016: Intro to HTTP
What is HTTP
HTTP is Hyper-Text Transfer Protocol.
> // There are two different ways to define functions in javascript. | |
> // Functions can be named, or anonymous. | |
> // The named function syntax looks more like a C- or Java-style "statement": | |
> function f(){ } | |
undefined | |
> // Notice it evaluates to "undefined". I'll come back to this in a sec. | |
> // The named function syntax binds the function to a local variable with the given name. | |
> f | |
[Function: f] | |
> // It also actually names the function object: |
#include <iostream> | |
#include <cstdlib> | |
#include <ctime> | |
#include <cmath> | |
using namespace std; | |
typedef void (*sorting_fun)(int[], int); |
// the self-calling function is a | |
// Javascript "module" pattern for | |
// not leaking stuff into global scope: | |
(function(){ | |
// simple closure example | |
function loglater(message){ | |
return function logger(){ | |
console.log(message); // references outer function's argument |
# find primes up to n | |
def sieve(n) | |
return n if n == 2 | |
s = (3..n).step(2).to_a | |
s.each { |i| s.reject! { |j| j != i && j % i == 0 } } | |
end | |
def new_sieve(n) | |
(s = maybe_primes(n)).each { |i| s.reject! { |j| j != i && j % i == 0 } } |
// ---- | |
// Sass (v3.4.12) | |
// Compass (v1.0.3) | |
// ---- | |
// RANGES | |
// We use these functions to define ranges for various things, like media queries. | |
@function lower-bound($range){ | |
@if length($range) <= 0 { | |
@return 0; |
showAllFiles () | |
{ | |
local new old=`defaults read com.apple.finder AppleShowAllFiles`; | |
if [ "$old" = "TRUE" ]; then | |
new="FALSE"; | |
else | |
new="TRUE"; | |
fi; | |
defaults write com.apple.finder AppleShowAllFiles $new; | |
echo -n "com.apple.finder AppleShowAllFiles = "; |
$ bash test.sh | |
This is what happens now. Simple Gemfile: | |
source 'https://rubygems.org' | |
gem 'listen' | |
Updating bundle... | |
Fetching gem metadata from https://rubygems.org/............ | |
Fetching version metadata from https://rubygems.org/... | |
Fetching dependency metadata from https://rubygems.org/.. | |
Resolving dependencies... |
Here are the lecture notes from May 16, 2016: Intro to HTTP
HTTP is Hyper-Text Transfer Protocol.
# basic sinatra app showing some use of sessions to handle | |
# some (insecure) authentication | |
require 'sinatra' | |
# enable default sessions support | |
# sessions are "like hashes" and get serialized (stringified) and | |
# stored directly in a session cookie. | |
# Sinatra (actually a Rack sessions extension) handles this for you | |
enable :sessions |
2016-05-18 breakout by Vaz
This breakout covered:
RACK_ENV
in the conventional way to use a different db for development than for tests