Skip to content

Instantly share code, notes, and snippets.

View ColinTheRobot's full-sized avatar

Colin Hart ColinTheRobot

View GitHub Profile
@ColinTheRobot
ColinTheRobot / 1_framework.rb
Created March 31, 2023 15:21 — forked from APiercey/1_framework.rb
Ruby 6 Line Micro Testing Framework
module MT
def self.assert(desc, left, operator, right = nil) = puts (if msgs = self.send(operator, desc, left, right) then failure(msgs) else success(desc) end)
def self.test(desc, &block) ; puts desc ; yield ; puts "\n" end
def self.success(msg) = " \e[32m#{msg}\e[0m"
def self.failure(msgs) = " \e[31m#{msgs.join("\n ")}\e[0m"
end
@ColinTheRobot
ColinTheRobot / rails.rb
Created March 27, 2023 14:32 — forked from castwide/rails.rb
Enhance Rails Intellisense in Solargraph
# The following comments fill some of the gaps in Solargraph's understanding of
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
# ignored at runtime.
#
# You can put this file anywhere in the project, as long as it gets included in
# the workspace maps. It's recommended that you keep it in a standalone file
# instead of pasting it into an existing one.
#
# @!parse
# class ActionController::Base
@ColinTheRobot
ColinTheRobot / submodules.md
Created June 5, 2018 11:27 — forked from manasthakur/submodules.md
Using git submodules to version-control Vim plugins

Using git-submodules to version-control Vim plugins

If you work across many computers (and even otherwise!), it's a good idea to keep a copy of your setup on the cloud, preferably in a git repository, and clone it on another machine when you need. Thus, you should keep the .vim directory along with your .vimrc version-controlled.

But when you have plugins installed inside .vim/bundle (if you use pathogen), or inside .vim/pack (if you use Vim 8's packages), keeping a copy where you want to be able to update the plugins (individual git repositories), as well as your vim-configuration as a whole, requires you to use git submodules.

Creating the repository

Initialize a git repository inside your .vim directory, add everything (including the vimrc), commit and push to a GitHub/BitBucket/GitLab repository:

cd ~/.vim
@ColinTheRobot
ColinTheRobot / postgres-brew.md
Created January 31, 2018 14:03 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
require 'socket'
module EventEmitter
def _callbacks
@_callbacks ||= Hash.new { |h, k| h[k] = [] }
end
def on(type, &blk)
_callbacks[type] << blk
self
@ColinTheRobot
ColinTheRobot / localmotion.js
Last active December 30, 2017 02:01
zipcar code challenge
var buildingsByIndex = { A: 0, B: 1, C: 2, D: 3, E: 4, F: 5, G: 6 };
function turn(vehicles, peoples, buildings) {
var DATA = buildData(vehicles, peoples, buildings);
vehicles.forEach(function(vehicle, index) {
// TODO: needs some refactoring. fair bit of duplicate logic.
if (!vehicle.state.arrivedAtFirstBuilding) {
vehicle.moveTo(buildings[index]);
@ColinTheRobot
ColinTheRobot / presentation.md
Last active March 16, 2017 13:49
dyslexia + comic sans
<style> blockquote { font-family: Georgia, serif; font-size: 18px; font-style: italic; width: 100% !important; margin: 0.25em 0; padding: 0.35em 40px; line-height: 1.45; position: relative;

Web Development

Immersive Remote (WDIR)


#### who are we; what do we do; what we've learned. ---

Who are we?

We're currently two teams of four.

From https://git-scm.com/docs/git-checkout/1.7.3.1

--orphan Create a new orphan branch, named <\new_branch>, started from <start_point> and switch to it. The first commit made on this new branch will have no parents and it will be the root of a new history totally disconnected from all the other branches and commits.

The index and the working tree are adjusted as if you had previously run "git checkout <start_point>". This allows you to start a new history that records a set of paths similar to <start_point> by easily running "git commit -a" to make the root commit.

This can be useful when you want to publish the tree from a commit without exposing its full history. You might want to do this to publish an open source branch of a project whose current tree is "clean", but whose full history contains proprietary or otherwise encumbered bits of code.

If you want to start a disconnected history that records a set of paths that is totally different from the one of , then you should clear the index

# House Keeping
Open your .gitignore in your student repo and add node_modules save and close the file
How many of you actually use or go to the wiki
### Objectives
- Explain what Node.js is & why it exists
- Compare and contrast Node/Express vs. Ruby/Sinatra/Rails
- Recall/Demonstrate the process of setting up a node and express application
- Create routes in express