This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://news.ycombinator.com/item?id=13889155 | |
7 git rules: | |
1. Separate subject from body with a blank line | |
2. Limit the subject line to 50 characters | |
3. Capitalize the subject line | |
4. Do not end the subject line with a period | |
5. Use the imperative mood in the subject line | |
6. Wrap the body at 72 characters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.fse.guru/how-do-i-learn-functional-programming-in-javascript-linkpost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Player (mark) { | |
this.mark = mark | |
}; | |
function Space (x,y) { | |
this.coordinates = [x,y] | |
this.markedBy = undefined | |
}; | |
Space.prototype.marked = function(player) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://jacopretorius.net/2014/02/all-rails-db-rake-tasks-and-what-they-do.html | |
http://guides.rubyonrails.org/active_record_basics.html | |
# many to many | |
class CreateEmployeesProjects < ActiveRecord::Migration | |
def change | |
create_table(:employees_projects) , id: false do |t| | |
t.column(:employee_id, :integer) | |
t.column(:project_id, :integer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'fileutils' | |
require 'colorize' | |
puts `brew install tree` | |
puts `gem install colorize` | |
puts 'What are the names of the contributers?' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basic math functions added to Array class | |
class Array | |
def square | |
self.map { |n| n * n } | |
end | |
def cube | |
self.map { |n| n * n * n } | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "Enter a number you want to calculate up to in the Fibonacci sequence" | |
max = gets.chomp | |
#Fibonacci | |
sequence = [] | |
0.upto(max.to_i) do |num| | |
if num > 2 | |
what_to_push = sequence[num - 1] + sequence[num - 2] | |
sequence << what_to_push | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Draws the first cards for the game | |
def first_draw | |
@player_hand = @deck.to_a.sample(2).to_h | |
@computer_hand = @deck.to_a.sample(2).to_h | |
puts "Your Hand: #{@player_hand.keys.first} #{@player_hand.keys.last}" | |
puts "Computer's Hand: #{@computer_hand.keys.first}" | |
check_ace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Find size of Rails app files in order | |
$ clear && ls -lr | awk '{ print $5 "--" $9 }' | sort -gr | |
Sample Output: | |
5563--Gemfile.lock | |
1814--Guardfile | |
821--Gemfile | |
408--config | |
306--testss | |
272--app | |
255--README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function main { | |
`echo clear` | |
echo "Phonebooks on record:" | |
`echo find ~ -type f -name \*.dat` | |
echo "" | |
echo "Please select which phonebook" | |
echo "you would like to modify." | |
echo "Or you can create a newfile" |
NewerOlder