Skip to content

Instantly share code, notes, and snippets.

View TomK32's full-sized avatar

Thomas R. Koll TomK32

View GitHub Profile
@TomK32
TomK32 / gist:c310dae6af77e2d8e39a
Last active August 29, 2015 14:13
poor mam's red alert for devlol lolstripe
#!/bin/bash
cmd='mosquitto_pub -h 192.168.7.2 -t led';
times=$1 || 10;
for i in `seq 1 $times`
do
$cmd -m RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
echo 'DANGER!'
sleep 1
$cmd -m X
sleep 1
[Warning] Invalid CSS property declaration at: / (css.css, line 25)
[Warning] Invalid CSS property declaration at: / (css.css, line 68)
[Warning] Invalid CSS property declaration at: / (css.css, line 97)
[Warning] Invalid CSS property declaration at: / (css.css, line 114)
[Warning] Invalid CSS property declaration at: / (css.css, line 125)
[Warning] Invalid CSS property declaration at: / (css.css, line 126)
[Warning] Invalid CSS property declaration at: / (css.css, line 134)
[Warning] Invalid CSS property declaration at: / (css.css, line 143)
[Warning] Invalid CSS property declaration at: / (css.css, line 159)
[Warning] Invalid CSS property declaration at: / (css.css, line 161)
<%=
calendar_for(current_timespan.first.year, current_timespan.first.month,
:month_navigation_url_helper => :calendar_events_path,
:month_navigation_url_helper_args => {:section => @section} ) do |day|
if calendar_section.days_in_month_with_events(day).include?(day)
[link_to(day.day, calendar_events_path(:section => @section, :year => day.year, :month => day.month, :day => day.mday)), { :class => "dayWithEvents" }]
else
day.day
end
end
Given /I am logged in as "(.*)"/ do |username|
Given "there is a User \"#{username}\""
Given "I follow \"log in\""
end
!!!
%html{:xmlns => "http://www.w3.org/1999/xhtml", 'xml:lang' => 'en', :lang => 'en'}
%head
= render :partial => "shared/head"
%body
#wrapper
#header
= link_to 'vote.ananasblau', root_url
Processing Admin::InstallController#index (for 213.129.230.12 at 2009-08-21 18:52:25) [GET]
Parameters: {"action"=>"index", "controller"=>"admin/install"}
Rendering template within layouts/simple
Rendering admin/install/index
Completed in 425ms (View: 58, DB: 6) | 200 OK [http://blog.photostre.am/]
/!\ FAILSAFE /!\ Fri Aug 21 18:54:26 +0200 2009
Status: 500 Internal Server Error
undefined method `rewind' for #<IO:0x2b9d768ca980>
/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/request.rb:150:in `POST'
/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/methodoverride.rb:15:in `call'
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb
index 1dc7c96..cf6d574 100644
--- a/activerecord/lib/active_record/validations.rb
+++ b/activerecord/lib/active_record/validations.rb
@@ -105,6 +105,7 @@ module ActiveRecord
# blank: This title is screwed!
def generate_full_message(message, options = {})
keys = [
+ options.delete!(:default),
:"full_messages.#{@message}",
<IFRAME SRC="http://postedit.photostre.am/" WIDTH="960" HEIGHT="500px" FRAMEBORDER="0"> Your browser does not support IFRAME</IFRAME>
@TomK32
TomK32 / active_record_to_mongo_mapper_migration.rb
Created January 29, 2010 21:46
An ActiveRecord migration to migrate your database to MongoDB using MongoMapper
# The basic idea is that we take the existing data via ActiveRecord
# and create new documents in MongoDB using MongoMapper.
# This method is necessary as we want to keep all the associations of existing dataset
# and by the way, clean up empty columns
# We rely on models still being ActiveRecord::Base, I bet you can figure out how the look like.
# And have the newer MongoDB ones here in a module, painful as we have to set the collection_name
# Don't put a +timestamps!+ into your MongoMapper models yet because this would change the updated_at if existing
# As you see in the MongoDB models, a few loose their indepence, e.g. Source as I
# plan to add other sources besides flickr, or Page and Album which only make sense in
# their parent Website
trash_file = {
file_name: 'gorge_bush.jpg',
user: 'Anonymous',
tags: ['george', 'bush', 'shoe'],
comments: [{_id: new ObjectId(), user: 'Tom', comment: 'Yeah!'}, { _id: new ObjectId(), user: 'oib', comment: 'Hit him!'}],
created_at: new Date(),
points: 0,
delete_at: null,
}