This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def upload_sizing | |
result = {:export => {use: []}} | |
if uploads_enabled? | |
dims = (upload_width? && upload_height?) ? { width: upload_width, height: upload_height } : nil | |
dims_thumb = (upload_thumb_width? && upload_thumb_height?) ? { width: upload_thumb_width, height: upload_thumb_height } : nil | |
if enable_images? | |
if dims | |
result[:resize] = dims |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def upload_sizing; result = {:export => {use: []}} && (uploads_enabled? && (dims_upload = (upload_width? && upload_height? && { width: upload_width, height: upload_height }) || nil) || true) && (dims_thumb = (upload_thumb_width? && upload_thumb_height?) ? { width: upload_thumb_width, height: upload_thumb_height } : nil)) && [[enable_images?, dims_upload, :resize],[enable_images?, dims_thumb, :resize_thumb],[enable_videos?, dims_upload, :encode],[enable_videos?, dims_thumb, :encode_thumb]].inject(result) { |result, (cond, dims, key)| cond && dims && (result[key.to_sym] = dims) && (result[:export][:use] << key.to_s) }) || result; end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vagrant@vagrantup:/publisher$ bundle exec rails g model Platform::Subscription callback_url:string name:string external_id:string token:string secret:string verify_token:string service_id:string state:string type:string | |
invoke active_record | |
create db/migrate/20110714153150_create_platform_subscriptions.rb | |
create app/models/platform/subscription.rb | |
create app/models/platform.rb | |
invoke rspec | |
create spec/models/platform/subscription_spec.rb | |
error factory_girl [not found] | |
vagrant@vagrantup:/publisher$ cat db/migrate/20110714153150_create_platform_subscriptions.rbclass CreatePlatformSubscriptions < ActiveRecord::Migration | |
def self.up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// originally from: https://gist.github.com/1649063 | |
$(function () { | |
if (window.fluid) { | |
setInterval(function(){ | |
$('.image-preview-wrapper').not('.hideBtnAdded').each(function() { | |
var t = $(this); | |
if (t.find('.hideImg').length === 0) { | |
t.append('<button class="hideImg">Hide This Image</button>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this won't work because "this" doesn't map to this object | |
// when the click handler fires. | |
{ | |
setupHandler: function () { | |
$('button').click(function () {this.handleClicks}); | |
}, | |
handleClicks: function () { | |
alert("I got clicked"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Breakfast | |
========= | |
- Bada Bean | |
- Paisely Cafe | |
- Canopy Rd Cafe | |
- Lucy Leas cupcakes | |
Lunch | |
===== | |
- Paisely Cafe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EventsController < ApplicationController | |
before_filter :authenticate_user! | |
def index | |
end | |
def show | |
@event = Event.find_by_id(params[:id]) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true ; do printf 'HTTP/1.1 200 OK\r\n\r\ncool, thanks' | netcat -l -c -p 8888 > incoming.txt ; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you're a Republican who is aghast by Trump and his supporters, and if you believe that Trump is ruining your otherwise decent party, I hope your are asking yourself, "Why am I surprised by this? Is this what I've been supporting with my votes?" | |
The answer is yes. Trump isn't ruining your party. He's just making its less flattering core more obvious. Other GOP candidates ordinarily gloss over the fact that . They smile and invoke euphemisms about protecting family or raising concern about law and order, but they support the same ignorant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl "http://jsonip.com" | ruby -e "require 'json'; puts JSON.pretty_generate(JSON.parse(STDIN.gets))" | |
# { | |
# "ip": "....", | |
# "about": "/about", | |
# "Pro!": "http://getjsonip.com" | |
# } | |
# Here's one that copies it straight into your clipboard (on the Mac) | |
curl "http://jsonip.com" | ruby -e "require 'json'; puts JSON.pretty_generate(JSON.parse(STDIN.gets))" | pbcopy |
OlderNewer