Skip to content

Instantly share code, notes, and snippets.

@dannymcc
dannymcc / gist:840426
Created February 23, 2011 13:25
Display different layouts depending on login state
class ApplicationController < ActionController::Base
layout "another"
# another way
layout :another_by_method
private
def another_by_method
if current_user.nil?
"normal_layout"
else
dannys-macbook:/ danny$ id
uid=501(danny) gid=20(staff) groups=20(staff),501(access_bpf),401(com.apple.access_screensharing),403(com.apple.sharepoint.group.2),12(everyone),33(_appstore),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),100(_lpoperator),204(_developer),402(com.apple.sharepoint.group.1)
@dannymcc
dannymcc / gbase.php
Created September 30, 2011 19:27
Magneto Google Connect Fix
<code>
<?php
define('SAVE_FEED_LOCATION','google_base_feed.txt');
set_time_limit(1800);
require_once '../app/Mage.php';
Mage::app('default');
try{
$handle = fopen(SAVE_FEED_LOCATION, 'w');
$heading = array('id','mpn','title','description','link','image_link','price','brand','product_type','condition', 'google_product_category', 'manufacturer', 'availability');
@dannymcc
dannymcc / gist:1292854
Created October 17, 2011 15:22
Postmark Spam Check
-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low
trust
[74.205.19.142 listed in list.dnswl.org]
@dannymcc
dannymcc / caveatPatchor.js
Created October 21, 2011 22:32 — forked from protocool/caveatPatchor.js
Sample caveatPatchor.js file for use in Propane 1.1.2 and above
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
@dannymcc
dannymcc / gbase.php
Created October 24, 2011 09:49
Google Shopping Script
<?php
define('SAVE_FEED_LOCATION','google_base_feed.txt');
set_time_limit(1800);
require_once '../app/Mage.php';
Mage::app('default');
try{
$handle = fopen(SAVE_FEED_LOCATION, 'w');
$heading = array('id','mpn', 'upc','title','description','link','image_link','price','brand','product_type','condition', 'google_product_category', 'manufacturer', 'availability');
$feed_line=implode("\t", $heading)."\r\n";
@dannymcc
dannymcc / Heroku Log
Created October 27, 2011 20:59
Hubot fail :(
011-10-27T20:56:46+00:00 heroku[api]: Release v9 created by mail@domain.net
2011-10-27T20:56:46+00:00 heroku[app.1]: State changed from crashed to created
2011-10-27T20:56:46+00:00 heroku[app.1]: State changed from created to starting
2011-10-27T20:56:49+00:00 app[app.1]: bin/hubot: 3: npm: not found
2011-10-27T20:56:49+00:00 app[app.1]: Loading deploy-local scripts at /app/scripts
2011-10-27T20:56:49+00:00 app[app.1]: Loading hubot core scripts for relative scripts at /app/src/hubot/scripts
2011-10-27T20:56:49+00:00 app[app.1]: rooms: [ '442798' ],
2011-10-27T20:56:49+00:00 app[app.1]: domain: 'mysubdomainhere.campfirenow.com',
2011-10-27T20:56:49+00:00 app[app.1]: /^Hubot:?\s*(calc|calculate|convert|math)( me)? (.*)/i
2011-10-27T20:56:49+00:00 app[app.1]: /^Hubot:?\s*(the rules|the laws)/i
["tweet.coffee", "shipit.coffee", "help.coffee", "maps.coffee", "math.coffee", "ping.coffee", "roles.coffee", "rules.coffee", "storage.coffee", "translate.coffee", "youtube.coffee"]
2011-10-27T21:08:56+00:00 heroku[api]: Release v10 created by mail@domain.net
2011-10-27T21:08:56+00:00 heroku[app.1]: State changed from created to starting
2011-10-27T21:08:57+00:00 heroku[slugc]: Slug compilation finished
2011-10-27T21:08:58+00:00 heroku[app.1]: Starting process with command `bin/hubot -a campfire -n Hubot`
2011-10-27T21:08:59+00:00 app[app.1]: bin/hubot: 3: npm: not found
2011-10-27T21:08:59+00:00 app[app.1]: Loading deploy-local scripts at /app/scripts
2011-10-27T21:08:59+00:00 app[app.1]: Loading hubot core scripts for relative scripts at /app/src/hubot/scripts
2011-10-27T21:08:59+00:00 app[app.1]: { token: '899121231589618968889ace8ecce08631966334',
2011-10-27T21:08:59+00:00 app[app.1]: rooms: '443128',
2011-10-27T21:08:59+00:00 app[app.1]: account: 'mysubdomain' }
# Polite.
#
# Say thanks to your robot.
responses = [
"You're welcome",
"No problem",
"Anytime",
"That's what I'm here for!",
"You are more than welcome",