Skip to content

Instantly share code, notes, and snippets.

View austinbv's full-sized avatar
🎯
Focusing

Austin austinbv

🎯
Focusing
View GitHub Profile
mouse_draw = (e) ->
position = find_position(@)
e._x = e.clientX - position.x
e._y = e.clientY - position.y
$('#x').text(e._x)
$('#y').text(e._y)
if currentTool() == 'eraser'
$('#drawing').hide()
func = Narwhal.tools[currentTool()][e.type]
if func?
Scenario: Asking for advice
Given I ask for advice
When people try to help
Then I rage about what they say
And I rage about everything else
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
<%
# all your comment stuff can go here
%>
x = { 0 => "green", 1 => "yellow", 2 => "red" }
puts x[key[value]]
:conditions => ['(`x`.y < ?
AND `x`.z > ?)
OR (`x`.a < ?
AND `x`.a > ?)
OR (`x`.b > ?)',
Date.today, Date.today, Date.today, Date.today, Date.today ]
[~]$ sudo iptables -nvL
Chain INPUT (policy ACCEPT 125K packets, 118M bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 70113 packets, 10M bytes)
pkts bytes target prot opt in out source destination
class Integer
def place
case self % 10
when 1
"#{self}st"
when 2
"#{self}nd"
when 3
"#{self}rd"
when 4..9, 0
class Integer
def rank
case self % 10
when 1
"#{self}st"
when 2
"#{self}nd"
when 3
"#{self}rd"
when 4..9, 0
project/
spec/
spec_helper.rb
first_spec.rb
first.rb