Skip to content

Instantly share code, notes, and snippets.

@cbfrance
cbfrance / rainbow
Created January 1, 2011 07:20
viewport rainbows with @media conditions
# #!/usr/bin/ruby
rgb_value = 255
pixel_coordinate = rgb_value * 10
while pixel_coordinate > 0 do
print "@media only screen and (max-width: #{pixel_coordinate}px) { \n body { \n background-color: rgb(#{rgb_value},#{rgb_value},#{rgb_value}); } \n }\n"
(pixel_coordinate / 255) % 2 == 0 ? rgb_value += 1 : rgb_value -= 1
pixel_coordinate -= 1
end
@cbfrance
cbfrance / global gitignore
Created November 30, 2010 03:12
~/.global_ignore
# git config --global core.excludesfile ~/.global_ignore
#apple cruft
.DS_Store
.DS_Store?
Icon?
# Thumbnails
._*
@cbfrance
cbfrance / 4636-style-checklist
Created November 5, 2010 22:30
Checklist for 4236 style deployment
Checklist for 4236 style deployment
From the crisismappers list
00: Define what you want to accomplish with this deployment -
consider it the "mission statement" part of the Mission 4636. Useful
for explaining to citizens, responders, press exactly what it is that
you are doing and will help clarify the design / implementation
process going forward.
#!/usr/bin/ruby
#This does what I need done when creating a new site on Ubuntu.
#you probably have different stuff here:
site_path = "/www/sites"
available_path = "/www/confs/sites-available"
enabled_path = "/www/confs/sites-enabled"
log_path = "/www/logs"
puts "==> Enter the domain you want to setup, without subdomains or TLDs (likethis):"
#!/usr/bin/ruby
require 'rubygems'
require 'flickraw'
# via http://www.valibuk.net/2010/03/access-flickr-with-ruby-and-flickraw/#comment-158964
id = "11104587@N07"
flickr.photos.search(:user_id => id)
puts "Your user ID is #{id}"
flickr.photos.search(:user_id => id, :tags => 'swift').each do |p|
if File.exist?('haiti.json.txt')
# parse the file
p "reading from the existing file ...."
jsonfile= File.open("haiti.json.txt", "r")
results= jsonfile.read
parsed_results= Crack::JSON.parse(results)
@incidents = parsed_results['payload']['incidents']
pdf.bounding_box([x_pos, y_pos], :width => 300, :height => 400) do
@incidents.each do |i|
@cbfrance
cbfrance / RTL-aware wonky link
Created February 6, 2010 03:15
Example of SASS and Compass mixins
<html>
<pre>
<code>
____
___ .-~. /_"-._
`-._~-. / /_ "~o\ :Y
\ \ / : \~x. ` ')
] Y / | Y< ~-.__j
/ ! _.--~T : l l< /.-~
/ / ____.--~ . ` l /~\ \<|Y
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1='\u@\h \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ '
=chunkybacon(!yes = !green, !please_and= !light_grey)
+hover-link
+rounded
:padding 2px
:display block
:font-weight bold
:background = !please_and
:color= !please_and - !light_grey
&:hover
:background= !yes