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
source "https://rubygems.org" | |
gem 'curb' |
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
> text = 'some text' | |
=> "some text" | |
> hash_options = {rant_id:1,date:11/04/2014,top:text,number:12} | |
=> {:rant_id=>1, :date=>0, :top=>"some text", :number=>12} | |
NOTE that 'date' gets set to zero, because it's being interpreted as, "11 divided by 04 divided by 2014" | |
Also this: | |
> hash_options = rant_id:1,date:11/04/2014,top:text,number:12 |
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
""" | |
The FooBar Card Game! | |
The game is simple: | |
1. Start a deck of cards | |
2. Shuffle the deck | |
3. Every player has a "hand" - a list of cards they are holding | |
4. Deal all cards from the deck as evenly as possible to all players | |
5. Score the cards - the player with the highest score WINS!" |
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
def cow(): | |
"""See: http://en.wikipedia.org/wiki/Cattle""" | |
return { | |
'sound': 'moo', | |
'legs': 4, | |
'covering': 'hair' | |
} | |
def horse(): | |
"""See: http://en.wikipedia.org/wiki/Horse""" |
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
class OpenNotification < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :listing | |
validates_presence_of :user_id | |
validates_presence_of :listing_id | |
validates_uniqueness_of :listing_id, :scope => :user_id | |
validate :a_user_cannot_get_a_notification_for_their_own_listing | |
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
XML response for the main grid (translationsFeed): | |
<?xml version='1.0' encoding='utf-8'?><rows><page>1</page><total>1</total><records>10</records><row id='2'><cell><![CDATA[2]]></cell><cell><![CDATA[6]]></cell><cell><![CDATA[EN]]></cell><cell><![CDATA[Cheese]]></cell><cell><![CDATA[It's cheesy goodness!]]></cell><cell>2011-06-20 14:53:52</cell><cell>2011-06-23 12:28:39</cell><cell><![CDATA[No]]></cell></row><row id='1'><cell><![CDATA[1]]></cell><cell><![CDATA[]]></cell><cell><![CDATA[EN]]></cell><cell><![CDATA[Hello!]]></cell><cell><![CDATA[]]></cell><cell></cell><cell></cell><cell><![CDATA[No]]></cell></row><row id='5'><cell><![CDATA[5]]></cell><cell><![CDATA[]]></cell><cell><![CDATA[EN]]></cell><cell><![CDATA[How are you feeling today?]]></cell><cell><![CDATA[]]></cell><cell></cell><cell></cell><cell><![CDATA[No]]></cell></row><row id='4'><cell><![CDATA[4]]></cell><cell><![CDATA[]]></cell><cell><![CDATA[EN]]></cell><cell><![CDATA[How much does this cost?]]></cell><cell><![CDATA[]]></cell><cell></cell><cell |
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
class Order < ActiveRecord::Base | |
... | |
after_initialize :init | |
before_validation :can_be_placed? | |
before_save :process_transaction, :on => :create | |
validates :customer_id, | |
:company_id, |
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
class Order < ActiveRecord::Base | |
# This array includes the list of possible states that an Order can be in. These reflect the steps | |
# that an order goes through from placement to fulfilment. | |
# | |
# nil The initial state of any Order record | |
# checking_terminals Checking if the terminals involved in this order are online | |
# terminals_offline One of more of the printers/terminals for this order are offline | |
# charging Attempting to charge the customer's credit card via BrainTree | |
# failed_to_charge BrainTree returned an error |
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
# What ports, IPs and protocols we listen for | |
Port 22 | |
Protocol 2 | |
# HostKeys for protocol version 2 | |
HostKey /etc/ssh/ssh_host_rsa_key | |
HostKey /etc/ssh/ssh_host_dsa_key | |
HostKey /etc/ssh/ssh_host_ecdsa_key | |
UsePrivilegeSeparation yes |
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
pi@pi ~ $ tail -n 10000 /var/log/syslog | |
Aug 6 15:40:00 pi pppd[1479]: Connection terminated. | |
Aug 6 15:40:00 pi avahi-daemon[2868]: Withdrawing workstation service for ppp0. | |
Aug 6 15:40:00 pi pppd[1479]: using channel 1815 | |
Aug 6 15:40:00 pi pppd[1479]: Using interface ppp0 | |
Aug 6 15:40:00 pi pppd[1479]: Connect: ppp0 <--> /dev/pts/0 | |
Aug 6 15:40:00 pi pptp[14671]: anon fatal[get_ip_address:pptp.c:437]: getaddrinfo(): Name or service not known | |
Aug 6 15:40:00 pi pppd[1479]: Script pptp [VPN SERVER IP] --nolaunchpppd --debug finished (pid 14670), status = 0x1 | |
Aug 6 15:40:00 pi pppd[1479]: Modem hangup | |
Aug 6 15:40:00 pi pppd[1479]: Connection terminated. |
OlderNewer