Skip to content

Instantly share code, notes, and snippets.

Thomas Rodriguez trodrigu

Block or report user

Report or block trodrigu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@trodrigu
trodrigu / find_path.rb
Created Aug 23, 2018
Longest increasing path in a matrix
View find_path.rb
def find_longest_rising_route(matrix)
matrix_with_locations =
matrix.each_with_index.map do |row, index|
row.each_with_index.map do |el, inner_index|
[index, [inner_index, el]]
end
end
sorted_with_locations =
@trodrigu
trodrigu / make_custom.applescript
Created Jul 23, 2018
make custom dog name in illustrator
View make_custom.applescript
set saveLocation to ((path to desktop) as string)
set fullPath to saveLocation & "newDogName"
set newFilePath to fullPath & ".svg"
log fullPath
tell application "Adobe Illustrator"
activate
make document with properties {name:"dogName"}
set theFrame to (make new text frame in current document with properties {contents:"Chi Chi", kind:area text, name:"notes"})
make new character style in document 1 with properties {name:"dog Name Character Style"}
@trodrigu
trodrigu / solution_to_rails_bundle_installation
Last active May 27, 2016
Solves problem with libv8, therubyracer and event_machine
View solution_to_rails_bundle_installation
gem install eventmachine -v '1.0.7' -- --with-cppflags=-I/usr/local/opt/openssl/include
gem uninstall libv8
gem install therubyracer -v YOUR_RUBY_RACER_VERSION
gem install libv8 -v YOUR_VERSION -- --with-system-v8
# if issue with capybara-webkit
brew install qt
@trodrigu
trodrigu / remove_header.sh
Created Mar 18, 2016
Shell script to remove lines from top of file
View remove_header.sh
#!/bin/bash
# Make sure to chmod +x remove_header.sh
ag 'Created (?=by)' -l | while read file
do
sed -i .bak '1,17d' $file
rm "$file.bak"
done
View 213.rb
class Rule90
def initialize input
@input = input.split(//).map(&:to_i)
end
def get_next target_index, input
input[target_index + 1]
end
def get_prev target_index, input
View rad
echo "Enter app name "
read name
echo "Your app's name is: $name"
echo "Installing..."
rails new $name -T -d postgresql
cd $name
echo 'gem "rspec-rails", :group => [:development, :test]' >> Gemfile
bundle
rails g rspec:install
echo 'gem "devise"' >> Gemfile
View index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to
has_one
You can’t perform that action at this time.