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 | |
# List all keys stored in memcache. | |
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
require 'net/telnet' | |
headings = %w(id expires bytes cache_key) | |
rows = [] |
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 AccessCodeGenerator | |
def self.generate(size = 13) | |
charset = ([*('A'..'Z'),*('0'..'9')]-%w(0 1 5 8 B I L O S U)) | |
(0...size).map{ charset.to_a[SecureRandom.random_number(charset.size)] }.join | |
end | |
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
class people::ksaynice { | |
# ----- First thing first make you chooice of editor(s)! ----- | |
include textmate::textmate2::release # normal release | |
# include textmate::textmate2::beta # beta releases | |
# include textmate::textmate2::nightly # nightly releases | |
# # sublime_text For the latest build of v3 | |
# include sublime_text | |
# sublime_text::package { 'Emmet': |
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 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>DVTConsoleDebuggerInputTextColor</key> | |
<string>0.811765 0.796078 0.564706 1</string> | |
<key>DVTConsoleDebuggerInputTextFont</key> | |
<string>Inconsolata - 16.0</string> | |
<key>DVTConsoleDebuggerOutputTextColor</key> | |
<string>1 1 1 1</string> |
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 merge_sort(arr) | |
return arr if arr.size <= 1 | |
left, right = halve_array(arr) | |
left_part = merge_sort(left) | |
right_part = merge_sort(right) | |
array = [] | |
offset_left_part = 0 | |
offset_right_part = 0 |
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
/* Fallback styles */ | |
.book { | |
display: inline-block; | |
box-shadow: 5px 5px 20px #333; | |
margin: 10px; | |
} | |
.book img { vertical-align: middle; } | |
/* |
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
{ | |
/* Remap Home / End keys to be correct ~/Library/KeyBindings*/ | |
"\UF729" = "moveToBeginningOfLine:"; /* Home */ | |
"\UF72B" = "moveToEndOfLine:"; /* End */ | |
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */ | |
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */ | |
"^\UF729" = "moveToBeginningOfDocument:"; /* Ctrl + Home */ | |
"^\UF72B" = "moveToEndOfDocument:"; /* Ctrl + End */ | |
"$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Ctrl + Home */ | |
"$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; /* Shift + Ctrl + 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
#!/usr/bin/env ruby -wKU | |
# | |
require 'rexml/document' | |
xml = `curl -s "http://www.google.com/ig/api?weather=94030"` | |
doc = REXML::Document.new(xml) | |
condition = doc.root.elements["weather/current_conditions/condition"].attributes['data'] | |
wind_condition = doc.root.elements["weather/current_conditions/wind_condition"].attributes['data'] | |
wind_condition = wind_condition.match(/\d+/).to_s | |
temp_f = doc.root.elements["weather/current_conditions/temp_f"].attributes['data'] |
NewerOlder