Skip to content

Instantly share code, notes, and snippets.

@seb
seb / zoom.html
Created January 10, 2011 13:07
Cool css3 zoom effect for your google maps
<style type="text/css" media="screen">
#map {
-webkit-transition: all 0.5s ease-in-out;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
opacity: 1;
}
@seb
seb / gist:811138
Created February 4, 2011 14:02
Paperclip rake task to attach an image to fixtures
namespace :db do
namespace :fixtures do
desc "Attach image for the current RAILS_ENV for a given CLASS (and optional ATTACHMENT)"
task :loadimages => :environment do
require 'open-uri'
io = open(URI.parse("http://upload.wikimedia.org/wikipedia/commons/9/96/Barbados_beach.jpg"))
def io.original_filename; base_uri.path.split('/').last; end
image = io.original_filename.blank? ? nil : io
for_all_attachments do |instance, name|
instance.send("#{name}=",image)
Processing Admin::PushesController#create (for 195.101.90.3 at 2011-01-07 17:49:48) [POST]
Parameters: {"commit"=>"Send notification", "authenticity_token"=>"uq4L86hJHiChF17jECA285TMRj6AHfSx8cv4jQThlsM=", "push"=>{"notification"=>{"aps"=>{"badge"=>"1", "sound"=>"push.caf", "alert"=>"9 nouvelles offres d’emploi pour débuter l’année dans les starting-blocks"}, "tab"=>"Jobs"}, "header"=>{"incremental_badge"=>"true"}}}
{"notification":{"aps":{"badge":1,"alert":"9 nouvelles offres d\u2019emploi pour d\u00e9buter l\u2019ann\u00e9e dans les starting-blocks","sound":"push.caf"},"tab":"Jobs"},"header":{"incremental_badge":"true"}}
Processing Admin::PushesController#create (for 195.101.90.3 at 2011-02-04 15:44:11) [POST]
Parameters: {"commit"=>"Send notification", "authenticity_token"=>"5K0IJtpgk53ML3R0VD8mFUI0shnNY4TZJZWwk78c8F0=", "push"=>{"sound"=>"push.caf", "message"=>"Twittez l’offre spéciale d’étapes : et gagnez des abonnements gratuits", "tab"=>"News"}}
"{\"notification\":{\"aps\":{\"badge\":1,\"sound\":f
@seb
seb / paperclip_rake_test.rb
Created February 28, 2011 11:38
Rake command to launch paperclip image attachment
RAILS_ENV="test" rake db:fixtures:loadimages CLASS="Image"<br /> .................. Done
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1622489-8']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
@font-face {
font-family: "NeuzeitTextbookRegular";
src: url(/fonts/neuzeittextbook_regular-webfont.eot?1300874573);
src: local("☺"), url(/fonts/neuzeittextbook_regular-webfont.woff?1300874573) format("woff"), url(/fonts/neuzeittextbook_regular-webfont.ttf?1300874573) format("truetype"), url("/fonts/neuzeittextbook_regular-webfont.svg#webfontJ6Q9a4kP") format("svg");
font-weight: normal;
font-style: normal; }
When "filling a new todo task" do
Then "should see its newly added task" do
visit '/'
fill_in "task_message", :with => "I have to read some BDD books"
click_button "Todo!"
within("#nav_badge") do
page.should have_content(3)
end
within("#todo_badge") do
page.should have_content(3)
def index
@magazine = Magazine.published.first
@published_magazines = Magazine.published
if @magazine
@summaries = @magazine.pages.summaries
@description = @magazine.metadescription
redirect_to magazine_url(@magazine)
else
redirect_to new_magazine_path
@seb
seb / gist:1199991
Created September 7, 2011 07:48
Cleaning file
f = File.new("clean.csv", 'a')
File.open('members_Pyramyd_NTCV_Sep_6_2011.csv').each do |line|
f.puts line.split(",")[0..2].join(',')
end
<script type="text/javascript" charset="utf-8">
var currentPage = 5;
function nearBottomOfPage() {
return scrollDistanceFromBottom() < 150;
}
function scrollDistanceFromBottom(argument) {
return $(document).height()-$(window).scrollTop()-$(window).height();