Skip to content

Instantly share code, notes, and snippets.

View bmneely's full-sized avatar

Ben Neely bmneely

  • Kount
  • Boise, ID
View GitHub Profile
@bmneely
bmneely / checkpoint_template.md
Last active May 25, 2018 14:47
Checkpoint Template

NOTE This template provides a structured and consistent way to create new checkpoints. Please do your very best to include/use each section of this template.

<!-- Blync meta data -->

Overview and Purpose

In this checkpoint you _________________________.

Objectives (phrased in a Bloom-y way)

#Full Stack Rails vs Full Stack JavaScript
Aspiring developers often ask “should I learn Rails or JavaScript to become a web developer?” Most students are concerned with picking a language that is easy to learn and that will offer them strong job prospects. Thankfully both Rails and JavaScript are great learning languages and open the door to many job opportunities.
##Learning
There are many aspects to consider when deciding whether a language is good for learning. Foremost among these is whether the language is beginner friendly, how extensive and support the community and resources are, and whether or not best practices are emphasized.
###Beginner Friendly
Rails uses the Ruby programming language, which focuses on simplicity and productivity. The creator of Ruby, [Yukihiro Matsumoto](http://en.wikipedia.org/wiki/Yukihiro_Matsumoto), designed it to have an elegant syntax that is natural to read and easy to write. As such, printing out a “Hello world” is as easy as:
```ruby
puts “Hello world”
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "fedora"
@bmneely
bmneely / votes_controller.rb
Created August 7, 2014 04:33
votes_controller
class VotesController < ApplicationController
before_action :load_post_and_vote
def update_vote(new_value)
if @vote
authorize @vote, :update?
@vote.update_attribute(:value, new_value)
else
@vote = current_user.votes.build(value: new_value, post: @post)
authorize @vote, :create?
@bmneely
bmneely / grid.html
Last active August 29, 2015 14:02
24 column grid
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-1">
<div class="row">
<div class="col-mid-6">
</div>
<div class="col-mid-6">
</div>
</row>
# Better
attribute = "{0}_{1}".format(match_rule.ttype, 'string_start')
starts_with = match_rule.__dict__[attribute]
# Bad
match_rule.__dict__["{0}_{1}".format(match_rule.ttype, 'string_start')]

OS X 10.10 Guide

Here's what I did to get things working.

1. Install Xcode 6

Yep, over at: https://developer.apple.com

2. Install the Command Line Tools (CLT)

- Install XCode from the app store.
- Install XCode command-line tools.
$ xcode-select --install
- Install home brew. http://brew.sh/
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install database development packages.
$ brew install postgresql
@bmneely
bmneely / profiles_controller.rb
Created April 12, 2014 18:01
profiles_controller.rb
class ProfilesController < ApplicationController
def new
@user = User.find(params[:user_id])
@profile = Profile.new
end
def show
@user = User.find(params[:user_id])
@profile = Profile.find(params[:id])
end
#include <stdio.h>
#include <sys/times.h> /* for times system call */
#include <sys/time.h> /* for gettimeofday system call */
#include <unistd.h>
/*
---------------------------------------------------------------------------