Skip to content

Instantly share code, notes, and snippets.

View shirts's full-sized avatar

shirts shirts

  • probably somewhere
View GitHub Profile
  1. Change pointer when hovering over 'change key' in menu
  2. New users will not know the radio is public/private
  3. Word line-wrapping
  4. Change placement of 'New Note' in menu.. Possibly a '+' icon
  5. set a note to default open
  6. esc shorcut to exit menu -> back to note
  7. Copy/pasta
@shirts
shirts / gist:8f046a4c1982229b8e2d
Last active November 10, 2016 15:14
Capybara/Rspec Cheat Sheet
Capybara::Screenshot.screenshot_and_save_page
=Debugging=
require 'pry'
binding.pry
=Navigating=
visit('/projects')
visit(post_comments_path(post))

Capybara

save_and_open_page

Matchers

have_button(locator)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
{
jokes: [
{
question: "Can a cat play patty-cake?",
answer: "Pawsibly!"
},
{
question: "Why was the cat so small?",
answer: "Because it only drank condensed milk!"
},
@shirts
shirts / ruby_combination_generator.rb
Created April 17, 2016 19:47
Ruby Combination Generator
# uses gem combination_generator
# generates all possible 8 character combinations for letters A-Z
# writes combinations to file combinations.txt
require 'combination_generator'
alphabet = ('a'..'z').to_a.map(&:upcase!)
combinations = []
CombinationGenerator.new(8, alphabet).each {|combo| combinations << combo }
f = File.new 'combinations.txt', 'w'
#!/usr/bin/ruby
require 'date'
class Date
def self.months_between(d1, d2)
months = []
start_date = Date.civil(d1.year, d1.month, 1)
end_date = Date.civil(d2.year, d2.month, 1)
Manage Emulators
android avd
Run Emulator
emulator -avd <AVD_Name>
Install apk onto emulator
adb -e install <path to apk>
@shirts
shirts / sort.rb
Created October 14, 2016 02:25
Custom Ruby sort implementation
def sort(original)
sorted = []
original.each do |original_num|
if sorted.empty? || original_num > sorted.last
sorted << original_num
next
else
sorted.each do |sorted_num|
if original_num <= sorted_num
sorted.insert(sorted.index(sorted_num), original_num)
@shirts
shirts / tmux.conf
Last active February 28, 2017 17:53 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# Usage:
# - Prefix is set to Ctrl-a (make sure you remapped Caps Lock to Ctrl)
# - All prefixed with Ctrl-a
# - Last used window: /
# - Last used pane: ;
# - Vertical split: v
# - Horizontal split: s
# - Previous window: [
# - Next window: ]
# - Choose session: Ctrl-s