Skip to content

Instantly share code, notes, and snippets.

@noomerikal
noomerikal / carrierwave.rb
Created October 19, 2012 17:18 — forked from yortz/carrierwave.rb
image_uploader.rb
#config/initializers/carrierwave.rb
CarrierWave.configure do |config|
if Rails.env.production? or Rails.env.development?
config.storage :cloud_files
config.cloud_files_username = "your_username"
config.cloud_files_api_key = "your_key"
config.cloud_files_container = "test"
config.cloud_files_cdn_host = "c0012345.cdnn.cloudfiles.rackspacecloud.com"
def store_dir
@noomerikal
noomerikal / viderror
Created November 5, 2012 17:07
video import error
2012-11-05T17:03:32+00:00 app[web.1]: Started GET "/design" for 71.165.73.99 at 2012-11-05 17:03:32 +0000
2012-11-05T17:03:32+00:00 app[web.1]: Processing by DesignController#index as JSON
2012-11-05T17:03:32+00:00 app[web.1]: Artist Load (1.2ms) SELECT "artists".* FROM "artists" WHERE "artists"."id" = 99 LIMIT 1
2012-11-05T17:03:32+00:00 app[web.1]: Network Load (1.4ms)
[0m SELECT "networks".* FROM "networks" WHERE "networks"."networkable_id" = 99 AND "networks"."networkable_type" = 'Artist'
2012-11-05T17:03:32+00:00 app[web.1]: Rendered design/_import_status.html.erb (0.0ms)
2012-11-05T17:03:32+00:00 app[web.1]: Rendered design/_video_grid.html.erb (0.2ms)
2012-11-05T17:03:32+00:00 app[web.1]: Rendered design/index.html.erb within layouts/application (12.6ms)
2012-11-05T17:03:32+00:00 app[web.1]: Rendered shared/_head.html.erb (1.0ms)
2012-11-05T17:03:32+00:00 app[web.1]: Rendered shared/_kissmetrics.html.erb (0.8ms)
// Two ways to serve transparent GIF
var buf = new Buffer([
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00,
0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x2c,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02,
0x02, 0x44, 0x01, 0x00, 0x3b]);
res.send(buf, { 'Content-Type': 'image/gif' }, 200);
@noomerikal
noomerikal / README.md
Created February 17, 2013 21:23 — forked from croaky/README.md

Rails app

is a Rails 3.1 app running on Ruby 1.9.2 and deployed to Heroku's Cedar stack. It has an RSpec and Cucumber test suite which should be run before commiting to the master branch.

Running tests

Create aliases:

//
// GIFDownloader.h
// TheJoysOfCode
//
// Created by Bob on 29/10/12.
// Copyright (c) 2012 Tall Developments. All rights reserved.
//
#import <Foundation/Foundation.h>
<?xml version="1.0"?>
<response>
<timestamp>2012-11-21T16:18:26Z</timestamp>
<resultsOffset>0</resultsOffset>
<status>success</status>
<resultsLimit>5</resultsLimit>
<resultsCount>22</resultsCount>
<headlines>
<headlinesItem>
<headline>Lakers edge Nets as Mike D'Antoni makes debut on L.A. bench</headline>
{
"resultsLimit":5,
"resultsOffset":0,
"resultsCount":5,
"listings":[
{
"name":"SportsCenter",
"shortName":"",
"id":537483,
"episodeId":"e11493518",
// Example JSONP request with jQuery
$.ajax({
url: "http://api.espn.com/v1/sports/news/headlines",
data: {
// enter your developer api key here
apikey: "{api key}",
// the type of data you're expecting back from the api
_accept: "application/json"
},
dataType: "jsonp",
{
"sports":[
{
"name":"basketball",
"id":40,
"leagues":[
{
"name":"NCAA Basketball",
"abbreviation":"mens-college-basketball",
"id":41,
<?xml version="1.0"?>
<response>
<sports>
<sportsItem>
<name>basketball</name>
<id>40</id>
<leagues>
<leaguesItem>
<name>NCAA Basketball</name>
<abbreviation>mens-college-basketball</abbreviation>