Skip to content

Instantly share code, notes, and snippets.

View Spaceghost's full-sized avatar
👻
Building distributed and decentralized systems that run in the browser

Johnneylee Jack Rollins Spaceghost

👻
Building distributed and decentralized systems that run in the browser
View GitHub Profile

How-to setup a simple git push deployment

These are my notes basically. I first created this just as a reminder for myself. Feel free to use this for your project as a starting point.

On the server (example.com)

  1. Create a user on example.com, as which we (the git client) connects (push) to exmaple.com.
sudo useradd -m -s /usr/bin/git-shell git
def search(tp_id1, rule_id1, tp_id2, rule_id2)
ActiveRecord::Base.connection.execute("SELECT * FROM tracked_points, rules WHERE (tracked_points.id = ? AND rules.id = ?) OR (tracked_points.id = ? AND rules.id = ?)", tp_id1, rule_id1, tp_id2, rule_id2)
end
# Module
# ------
module ProtectedFields
# There is probably a nicer way to do this...
def self.included(base)
base.class_eval {
def self.protected_attributes(attrs = [])
@@protected_attributes = attrs
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.damacy.releasemem</string>
<key>ProgramArguments</key>
<array>
<string>/Users/jrollins/usr/bin/releasemem.py</string>
</array>
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
@Spaceghost
Spaceghost / octocat_zen.sh
Created November 14, 2012 03:28 — forked from pengwynn/octocat_zen.sh
GitHub Zen
$ curl https://api.github.com/zen | octocatsay
MMM. .MMM
MMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMM ____________________________
MMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMM | Practicality beats purity. |
MMMMMMMMMMMMMMMMMMMMMMMM |_ ________________________|
MMMM::- -:::::::- -::MMMM |/
MM~:~ ~:::::~ ~:~MM
@Spaceghost
Spaceghost / SomeController
Created November 6, 2012 18:56 — forked from pankajmore/gist:4026700
local variable in js.erb
respond_to do |format|
format.js
end
def show
@course = OfferedCourse.find(params[:id])
end
@Spaceghost
Spaceghost / undefined_method_oddity_spec.rb
Created April 1, 2012 09:18
An RSpec "undefined method" oddity
ubuntu-desktop-x64 :: ~/Code » rspec 2274040/undefined_method_oddity_spec.rb
FF
Failures:
1) UndefinedMethodOddity correctly complaints 'expected: 1 time, received: 2 times'
Failure/Error: subject.should_receive(:bar)
(#<UndefinedMethodOddity:0x000000010b7c68>).bar(any args)
expected: 1 time
received: 0 times
MasterCourse -> MasterSection -> MasterStep -> MasterQuiz -> MasterQuestion -> MasterChoice
|| || ||
Course Step Choice
# It's pretty easy to set a custom method as the basis of your friendly_id if
# you want to incorporate information from another model in the friendly_id.
class City < ActiveRecord::Base
belongs_to :state
has_friendly_id :city_and_state, :use_slugs => true
# This will return something like "San Francisco, California". It can be used
# as a display name in your views, and also as the basis of the friendly_id
# because it will be processed by the plugin to remove spaces, punctuation,