Skip to content

Instantly share code, notes, and snippets.

@RJNY
RJNY / 0.2.1-boggle_class_from_methods.rb
Created February 20, 2014 22:16 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
# Solo Challenge (Unit 2, Week 4)
# Take your time to see what concepts you feel comfortable and confident with. You are welcome to conduct research online, but make sure your code represents your own work. Please refrain from asking others for help.
# Overview
# Create a class BoggleBoard that includes the functionality of your methods from the previous challenge.
# To do this, take a look at the methods you've created. How can they be integrated into your BoggleBoard class? What needs to change?
# 1) Instantiate a new board object
# Transform your driver code so that it creates a new board object. You'll need to pass the original 2D array as an argument (let's call that dice_grid because boggle_board is going to be an object now.)
@RJNY
RJNY / BCrypt_cheatsheet.rb
Last active August 29, 2015 14:02
BCrypt cheat sheet
# BCrypt Outline
# Config/Environment
require 'bcrypt'
# Gemfile
gem "bcrypt"
# Migration
t.string :password_hash, null: false
@RJNY
RJNY / learn.rb
Created February 28, 2015 23:00
recursion.rb
def recursion(arg, arg2=[]) #5
arg2 << arg
p arg2
if arg <= 0 #false
puts "arg: #{arg}, finished" #no
return
end
puts "before: #{arg}" # before: 5
recursion(arg-1, arg2) # recursion(4) ...brb
puts "after: #{arg}" #5
@RJNY
RJNY / .bash_profile
Last active August 29, 2015 14:24
OSX_Bash_template
# Awesome website for shell scripts: http://explainshell.com/
export PATH=/usr/local/bin:$PATH
### Look at http://alias.sh/ for more fun things like this
# For ruby development
which -s bundle && alias be="bundle exec"
# Some tests with git common commands
alias be='bundle exec'
@RJNY
RJNY / Preferences.sublime-settings
Last active September 17, 2015 18:34
sublime_defaults
{
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Eighties.tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_face": "inconsolata",
"font_size": 19,
"ignored_packages":
[
"Vintage",
"Markdown"
],
@RJNY
RJNY / React Vim Snippets
Created December 16, 2016 22:32
React Vim Snippets
#
# React snippets
#
snippet rnccf
import React, { PropTypes } from 'react'
import { View, StyleSheet, Text } from 'react-native'
$1.propTypes = {
@RJNY
RJNY / address.rb
Created February 10, 2017 19:15
code-sample-1
class Address < ActiveRecord::Base
include SmartyStreets
belongs_to :user
before_save :trim_zip_code, :activate
validates :line1, :zip_code, :user_id, presence: true
validate :validate_address
validates :city, :state, presence: true
after_commit :ensure_one_active_address, :update_user_location
@RJNY
RJNY / images.rb
Created February 10, 2017 19:16
code-sample-2
##################################################
##### app/models/piece.rb #####
##################################################
class Piece < ApplicationRecord
belongs_to :category
has_many :tags, as: :taggable
has_many :images, as: :imageable, dependent: :destroy
accepts_nested_attributes_for :images
@RJNY
RJNY / larp.rb
Created February 10, 2017 19:19
code-sample-3
class LayoutAndRowPosition < ActiveRecord::Base
default_scope { order('position') }
belongs_to :layout
belongs_to :row
acts_as_list scope: :layout
end

Section 1

The following questions are your technical evaluation. Your target audience is a senior developer. Demonstrate your understanding. Keep your answer concise. Try to keep answers within one to two paragraphs.

Questions

What does a doctype do?

doctype is an HTML element (not a tag). It's used to declare what kind of HTML is used in the document. They are required for legacy reasons. Without it, some browsers will enter quirks mode and