Skip to content

Instantly share code, notes, and snippets.

pizza_crust = "thin"
pizza_cheese = "super cheezy"
# so on
### vs ###
pizza = {
crust: "thin",
<!doctype>
<html>
<head>
<title>hi</title>
<style>
body, html {
background: <%= color %>;
font-family: monospace;
}
/*
// local
var separator = "| |";
// global
separator = "| |";
// string concat
message = "one" + separator + "two";
@mayfer
mayfer / index.html
Created August 7, 2015 19:59
socket.io!!!
<!doctype>
<html>
<head>
<title>hi</title>
<style>
body, html {
background: #aaa;
font-family: monospace;
@mayfer
mayfer / express.js
Created August 3, 2015 18:27
Node.js
// now using express to handle routing
var express = require('express');
var app = express();
var http = require('http');
var path = require('path');
// attach a middleware
var server = http.Server(app);
<html>
<head>
<title>Intro to Javascript</title>
<style>
body { background: #358; color: #fff; padding: 50px; font-family: sans-serif; }
</style>
<script>
@mayfer
mayfer / intro.rb
Created July 24, 2015 18:47
Ruby Review & Object Oriented Programming
people[0][:emails][2][:a]
((5 + 3) * 8 / 9 - 2)
subtract(divide(multiply(add(5, 3), 8), 9), 2)
people = [
@mayfer
mayfer / caching.ejs
Created July 15, 2015 17:32
Caching
<!doctype html>
<html>
<head>
<title>weather</title>
<style>
body, html {
background: #05a;
color: #fff;
font-family: monospace;
@mayfer
mayfer / server.rb
Created July 13, 2015 17:58
Intro to HTTP
require 'sinatra'
get '/' do
# whatever happens here happens on every request
puts "goodbye world"
response = "hello #{params[:username]} \n\n \
@mayfer
mayfer / anagram.rb
Created July 10, 2015 18:12
Algorithms & Data structures
def find_most_anagram
words = File.open('/usr/share/dict/words').read
hash = Hash.new { [] }
words.each_line do |word|
word = word.strip.downcase
signature = word.split('').sort.join('')