Skip to content

Instantly share code, notes, and snippets.

View bgreg's full-sized avatar

Greg bgreg

View GitHub Profile
def explain(string = "\n")
require "pp"
debug = true
pp string if debug
end
def hr
explain "-" * 80
end
@bgreg
bgreg / Web_development_from_zero.md
Last active June 28, 2017 18:12
Web development from zero

How do words even appear in the browser?

Browsers were originally created to share text documents, primarilly between Universities and research groups. Imagine having to mail notes accross the country when you need to collaborate with co-workers.

To help make the text readable, simple things like space between paragraphs, highlights, and headlines are needed. Think about all the things you do in a Microsoft Word document. Bold text, margins on the left and right of the screen. With text in the browser that we share, those details need to be communicated to your computer, and we use HTML for that.

For example, when you click bold in the toolbar for Word, it will darken the text and make it fatter. To do that in an web document, you would wrap your text in special tags that the browser can understand. It looks like this:

<b> Hi Mom! </b>

@bgreg
bgreg / .tmux.conf
Created December 31, 2016 20:19 — forked from snuggs/.tmux.conf
TMUX configuration file
##############################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#############################
#
# COPY AND PASTE
@bgreg
bgreg / spec runner
Last active October 26, 2016 18:01
Change the color of the iterm tab based on the return value of the last command. RSpec in this case. Good for writing code with fasts tests when you don't want to pay attention to the test window. I Usually use this with a file system watching tool like watchexec. `watchexec --exts js,rb ./bin/spec_runner`
#! /usr/local/bin/zsh
# bin/spec_runner
function color {
case $1 in
green)
echo -e "\033]6;1;bg;red;brightness;57\a"
echo -e "\033]6;1;bg;green;brightness;197\a"
echo -e "\033]6;1;bg;blue;brightness;77\a"
class Bottles
def song
verses(99, 0)
end
def verses(start, finish)
start.downto(finish).map {|i| verse(i)}.join("\n")
end
def verse(number)
#!/bin/sh
#
set -ex
TEMP_DIR="$(mktemp -d -t XXXX)"
# cleanup
trap 'RESULT=$?; rm -rf "$TEMP_DIR" ; exit $RESULT' INT TERM EXIT QUIT
OLD_PWD="$PWD"
cd "$TEMP_DIR"
You appear to be advocating a new:
[ ] cloud-hosted [ ] locally installable [ ] web-based [ ] browser-based [ ] language-agnostic
[ ] language-specific IDE. Your IDE will not succeed. Here is why it will not succeed.
You appear to believe that:
[ ] Syntax highlighting is what makes programming difficult
[ ] Garbage collection is free
[ ] Computers have infinite memory
[ ] Nobody really needs:
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')