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 Array | |
def interleave(other) | |
arr = [] | |
size.times { |i| arr << self[i]; arr << other[i] unless i + 1 > other.size } | |
left = other[size - 1 .. -1] | |
arr += left if left | |
arr | |
end | |
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
require 'sinatra/base' | |
class Kazoo::Sinatra < Sinatra::Base | |
def render(engine, data, options = {}, *args) | |
if !options[:views] && data.is_a?(Symbol) && !data.to_s.match('/') | |
data = :"#{decamelize(self.class.name)}/#{data}" | |
options[:layout] ||= :'layouts/application' | |
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
<html> | |
<head> | |
<title>Simple Slideshow</title> | |
<style type='text/css'> | |
#slideshow { position: relative; } | |
#slideshow img { position: absolute; top: 0; left: 0; } | |
</style> | |
<script src="jquery.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
var image_counter = -1; |
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
#!/bin/bash | |
cd `dirname $0`/../ | |
rails runner script/${1}.rb |
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
@users = User.all(if params[:verified] | |
{ needs_verification: false } | |
elsif params[:admin] | |
{ User.roles.name => 'admin' } | |
else | |
{ needs_verification: true } | |
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
screamer:carrierwave-vips eltiare$ rspec | |
(rspec:2129): GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed | |
(rspec:2129): GLib-GObject-WARNING **: cannot retrieve class for invalid (unclassed) type `<invalid>' | |
/Users/eltiare/.rvm/gems/ruby-1.9.3-p194/gems/ruby-vips-0.2.0/lib/vips_ext.bundle: [BUG] Segmentation fault | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0] | |
-- Control frame information ----------------------------------------------- | |
c:0023 p:-17580534911092 s:0068 b:0068 l:000067 d:000067 TOP |
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
# Here's what I have in my CarrierWave configuration file | |
require 'carrierwave/processing/mime_types' | |
CarrierWave.configure do |config| | |
config.fog_credentials = { | |
:provider => 'AWS', # required | |
:aws_access_key_id => 'REPLACE WITH AWS KEY', # required | |
:aws_secret_access_key => 'REPLACE WITH AWS SECRET' # required | |
} |
This file has been truncated, but you can view the full file.
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
screamer:carrierwave-vips eltiare$ brew install vips -HEAD | |
==> Downloading http://www.vips.ecs.soton.ac.uk/supported/current/vips-7.28.0.tar.gz | |
Already downloaded: /Library/Caches/Homebrew/vips-7.28.0.tar.gz | |
==> ./configure --prefix=/usr/local/Cellar/vips/7.28.0 | |
==> make install | |
Making install in libvips | |
Making install in include | |
Making install in vips | |
glib-mkenums --template enumtemplate \ | |
../../../libvips/include/vips/memory.h ../../../libvips/include/vips/foreign.h ../../../libvips/include/vips/arithmetic.h ../../../libvips/include/vips/conversion.h ../../../libvips/include/vips/util.h ../../../libvips/include/vips/image.h ../../../libvips/include/vips/object.h > xgen-geth && \ |
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
eltiare@debian:~/apps/rballey$ rails c | |
Loading development environment (Rails 3.2.8) | |
1.9.3p194 :001 > img = VIPS::JPEGReader.new('spec/fixtures/butterfly.jpg') | |
=> #<VIPS::JPEGReader:0x000000041154a0> | |
1.9.3p194 :003 > img.exif? | |
(irb):3: [BUG] Segmentation fault | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] | |
-- Control frame information ----------------------------------------------- | |
c:0029 p:---- s:0103 b:0103 l:000102 d:000102 CFUNC :exif? |
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
#!/usr/bin/env jruby | |
# Usage: | |
# Save this file to /usr/local/bin/copy-to-s3.rb | |
# You'll want to chmod +x this file to use it on the command line (Linux/OS X: chmod +x /usr/local/bin/copy-to-s3.rb) | |
# If you're having trouble using JRuby, check out RVM (https://rvm.io/) | |
# Install the fog gem: gem install fog (after running rvm use jruby, if required) | |
# This only works if the environment variable JRUBY_OPTS=--1.8. e.g.: export JRUBY_OPTS=--1.8 (Linux/OS X) | |
# You'll have to edit the options in the file at the top to match your S3 settings. | |
# |