Discover gists
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
function! s:Todo() | |
call s:OpenBufferFromCommand('ditz todo', function('s:IssueCallback')) | |
endfunction | |
function! s:TodoAll() | |
call s:OpenBufferFromCommand('ditz todo --all', function('s:IssueCallback')) | |
endfunction | |
function! s:Grep(args) | |
call s:OpenBufferFromCommand(printf('ditz grep "%s"', a:args), function('s:IssueCallback')) |
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
Hello #World #in #Whitespace * # # * # # # | |
+ *[Space] | |
+ #is #marked #with"#" # #[tab] #with"*" *line-feed #with #"+" * # *so | |
+it #would | |
+be #easier #to #write #again... #All *the *non-whitespace-characters #are *ignored... * # # | |
+ * | |
+ # # # # # * * # * * # # | |
+ * | |
+ # # # # # * * # * * * * | |
+ * |
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
grammar Example | |
rule reminder | |
"tell me " time "to " anything:(.+) | |
end | |
rule time | |
("at" / "on") " " word+ &"to " | |
end | |
rule word |
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
ActionController::Base.logger.info "[Base] Loading config/initializers/" + File.basename(__FILE__) | |
class String | |
def to_permalink | |
text = self.dup | |
replacements = { | |
# replacement special character(s) to be replaced | |
"A" => [ "À", "Á", "Â", "Ã", "Å"], | |
"Ae" => [ "Ä", "Æ" ], | |
"C" => [ "Ç" ], |
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
#/usr/bin/ruby | |
require 'net/ftp' | |
@filename = "date-"+Time.now.strftime("%Y%m%d-%H%M")+".sql" | |
@db_user = "db6663" | |
@db_password = "PASSWORD" | |
@db_host = "my.database-server.com" | |
@database = "database" | |
@backupdir = "/path/to/backup/directory" |
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 Users < Application | |
def update | |
@user = User.find(params[:id]) | |
if @user.with_access_to(:staff, :banned).update_attributes(params[:user]) | |
# success | |
end | |
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
foo |
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
#!/usr/bin/env ruby | |
# Stupid simple rsync backup script | |
# The first arg is an optional bandwidth limit, and the second is an optional --v (verbose) flag | |
def run_cmd_with_live_stdout(cmd) | |
$stdout.sync = true | |
STDOUT.sync = true | |
IO.popen(cmd) do |is| | |
until is.eof? |
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
foo bar ... | |
bla | |
... |
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
I want to JOIN only the last item | |
table_1 | |
------------ | |
id | Name | | |
============ | |
1 Bob | | |
============ | |
table_2 |