Skip to content

Instantly share code, notes, and snippets.

@james
james / run.rb
Last active August 29, 2015 13:58
require 'twitter'
require 'csv'
@client = Twitter::REST::Client.new do |config|
config.consumer_key = ""
config.consumer_secret = ""
config.access_token = ""
config.access_token_secret = ""
end
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?><moo xsi:noNamespaceSchemaLocation="http://www.moo.com/xsd/api_0.7.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><request><version>0.7</version><api_key>056014df-68e5-c0a802d2-47f0a98d-3045</api_key><call>build</call></request><payload><products><product><product_type>minicard</product_type><designs><design><image><url>http://peoplesmusicstore.com/images/uploaded/0000/0578/100_0098.JPG</url><type>variable</type><crop><auto>true</auto></crop></image><text_collection><minicard><text_line><id>1</id><string>The Sound Advise</string><bold>false</bold><align>left</align><font>modern</font><colour>#000000</colour></text_line><text_line><id>2</id><string></string><bold>false</bold><align>left</align><font>modern</font><colour>#000000</colour></text_line><text_line><id>3</id><string></string><bold>false</bold><align>left</align><font>modern</font><colour>#000000</colour></text_line><text_line><id>4</id><string>peoplesmusicstore.com/thesoundadvise</string><bold>false</

Keybase proof

I hereby claim:

  • I am james on github.
  • I am abscond (https://keybase.io/abscond) on keybase.
  • I have a public key whose fingerprint is 2440 6B38 61ED 4BD1 61B2 5F6F 3866 9EBB 7B84 70DA

To claim this, I am signing this object:

@james
james / menu_controller.rb
Last active August 29, 2015 14:07
A Rails controller I wrote in 2006. This is bad code. Don't copy it.
class PagesController < ApplicationController
layout 'site'
def show
@page = Page.find_by_url(params[:id], :limit => 1)
@content = @page.content.gsub(/£/, "&pound;")
@cat = @page.category
if @cat == 'overview' or @cat == 'menu' or @cat == 'offers'
@subcat = @cat
@cat = 'restaurant'
def self.up
create_table :orders do |t|
t.string :description
t.integer :amount
t.string :state, :default => 'pending'
t.timestamps
end
end
git clone --depth 1 git@peoplesmusicstore.unfuddle.com:peoplesmusicstore/app.git /var/www/apps/pms_accounting_production/releases/20081022164022 && cd /var/www/apps/pms_accounting_production/releases/20081022164022 && git checkout -b deploy '0ee2741c2e0dca51bcc76c1fe01a818d04ae02b8' && (echo 0ee2741c2e0dca51bcc76c1fe01a818d04ae02b8 > /var/www/apps/pms_accounting_production/releases/20081022164022/REVISION)
Initialized empty Git repository in /var/www/apps/pms_accounting_production/releases/20081022164022/.git/
remote: Counting objects: 4310, done.
remote: Compressing objects: 100% (3673/3673), done.
remote: Total 4310 (delta 335), reused 3992 (delta 278)
Receiving objects: 100% (4310/4310), 7.72 MiB | 501 KiB/s, done.
Resolving deltas: 100% (335/335), done.
fatal: reference is not a tree: 0ee2741c2e0dca51bcc76c1fe01a818d04ae02b8
class Array
def split_into(n)
(0...(s = (self.size.to_f/n).ceil)-1).inject([]) { |m, i| m << self.slice(s * i, s); m }
end
end
class Array
def split_into(n)
size = (self.size.to_f/n).ceil
result = []
Hi Jonathan,
Just a quick mail to see if you could be looking for work at the moment or know anyone who could be?
I have a couple of roles that I am trying to fill a the moment.
Many Thanks,
Martin.
----------------------
last_response = `curl http://www.macrumors.com/2009/06/06/wwdc-2009-spoiler-free-keynote-stream/`.gsub(/\d/,"")
while true
current_response = `curl http://www.macrumors.com/2009/06/06/wwdc-2009-spoiler-free-keynote-stream/`.gsub(/\d/,"")
unless last_response == current_response
`say aaaaaaaaaaaaarrgh steevie`
end
last_response = current_response
sleep 10
end
At my new job, we play with maps and do crazy things with spacial data storage. We use the PostreSQL database with PostGIS on top.
Whilst I'm not particularly involved in the development of these things, I do require to have it up and running to develop on the same application. So my first day at my new job wasn't very fun when I had to spend half of it figuring out this PostGIS thing. I never liked Databases (I'm still pushing for flat file storage in our apps), and this new foreign language was very hard, especially seeing as I immediately placed as head of Macintosh support at the company (both of them).
There were a few solutions out there, and I got myself in a pickle switching between custom builds, ports and binaries, unsure about what was what, and which path to go down.
I've now done it a few times, and this is what I find works for me:
1. Install the ["Unix Compatability Frameworks"][1] ([Direct Link][2]) by [Kyng Chaos][3]
2. From the Kyng Chaos [Postres Page][4] install [PostreSQL][5] (You migh