Skip to content

Instantly share code, notes, and snippets.

View XanderPSON's full-sized avatar

Xander Peterson XanderPSON

View GitHub Profile
@gabriel-r
gabriel-r / Open Safari|Chrome URL in Other Browser.scpt
Last active January 17, 2023 04:09 — forked from sillygwailo/Open in Chrome from Safari.scpt
Open in Chrome from Safari and vice versa
tell application "System Events"
set activeApp to name of first application process whose frontmost is true
if "Safari" is in activeApp then
tell application "Safari"
set theURL to URL of front document
end tell
tell application "Google Chrome"
if (count of (every window where visible is true)) is greater than 0 then
tell front window to make new tab
@vasanthk
vasanthk / System Design.md
Last active October 14, 2025 22:32
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@ltw
ltw / ar-associations.rb
Created September 22, 2015 15:06
ActiveRecord Breakout Code Notes
# id | user_id
class Profile
belongs_to :user
# is actually:
# def user
# User.find_by(id: self.user_id)
# end
end
class Hospital
attr_accessor :name, :address, :employees, :patients
def initialize(args)
@name = args[:name]
@address = args[:address]
@employees = args[:employees] || []
@patients = args[:patients] || []
end
@lrytz
lrytz / z-automator.png
Last active October 15, 2024 06:31
Shortcut for Syntax Highlighting in Keynote
@yjukaku
yjukaku / gist:8138580
Last active July 8, 2019 17:32
Play a fail/pass sound after an RSpec Suite without needing any other plugins or gems. This goes in your spec_helper.rb
config.after(:suite) do
examples = RSpec.world.filtered_examples.values.flatten
if examples.none?(&:exception)
file = "spec/pass.wav"
else
file = "spec/fail.wav"
end
fork{exec "play -q -V0 #{file}"}
@barnes7td
barnes7td / sublime_setup.md
Last active January 9, 2025 20:33
Sublime Terminal Setup

Setup Terminal for Sublime Shorcut "subl":

Open terminal and type:

1. Create a directory at ~/bin:

mkdir ~/bin

2. Copy sublime executable to your ~/bin directory:

@alexbevi
alexbevi / pre-commit.sh
Created August 23, 2012 12:05
Git pre-commit hook that checks ruby source files for Pry breakpoints
# Git pre-commit hook to check all staged Ruby (*.rb/haml/coffee) files
# for Pry binding references
#
# Installation
#
# ln -s /path/to/pre-commit.sh /path/to/project/.git/hooks/pre-commit
#
# Based on
#
# http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/
@MicahElliott
MicahElliott / rbenv-howto.md
Created April 17, 2012 18:11
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

@sillygwailo
sillygwailo / Open in Chrome from Safari.scpt
Created September 23, 2011 07:16
Open in Chrome from Safari and vice versa
-- from http://www.tuaw.com/2011/03/14/use-applescript-to-open-current-safari-url-in-google-chrome/
-- install FastScripts http://www.red-sweater.com/fastscripts/ and place this AppleScript in the Scripts applications folder for Google Chrome.
-- For me that was ~/Library/Scripts/Applications/Safari
-- You can then assign it a keyboard shortcut. I went with Cmd-Shift-C
property theURL : ""
tell application "Safari"
set theURL to URL of current tab of window 1
end tell
tell application "Google Chrome"