Skip to content

Instantly share code, notes, and snippets.

var closeVolume = function(pathVolume) {
var firstPoint, lastPoint, points;
if (pathVolume === null) {
return null;
}
points = pathVolume.shape.points;
if (points.length < 2) {
@nevernormal1
nevernormal1 / clipper.js
Last active February 14, 2019 02:13
Easel helper functions. Download this as a zip file and add dependencies to your app.
// rev 452
/********************************************************************************
* *
* Author : Angus Johnson *
* Version : 6.1.3a *
* Date : 22 January 2014 *
* Website : http://www.angusj.com *
* Copyright : Angus Johnson 2010-2014 *
* *
* License: *
@nevernormal1
nevernormal1 / .block
Last active April 17, 2024 07:19
SVG Jigsaw Puzzle Generator
license: MIT
@nevernormal1
nevernormal1 / gist:720445
Created November 29, 2010 19:35
MapReduce scripts
#!/usr/bin/env ruby
def dump_items(items)
if items.size > 1
items.each_with_index do |item_to_print, i|
items.each_with_index do |related_item, j|
next if item_to_print == related_item
puts "#{item_to_print}:#{related_item}\t1"
end
end
class << self
def image_styles
ActiveSupport::OrderedHash.new.tap do |styles|
styles[:original] = {:processors => [:slice]}
styles[:preview] = {:geometry => "100x100", :processors => [:thumbnail]}
end
end
end
has_attached_file :image,
rds.create_db_snapshot(
:db_snapshot_identifier => 'test-snap',
:db_instance_identifier => '[production-instance]'
)
rds.restore_db_instance_from_snapshot(
:db_snapshot_identifier => 'test-snap',
:db_instance_identifier => 'clone',
:db_instance_class => 'db.m1.small'
)
> mysqldump old_db -u user -p > inventables.sql
> mysql rds_db -u user -p -h [RDS_connection_string] < inventables.sql
db.authorize_db_security_group(:db_security_group_name => 'default', :ec2_security_group_name => '[our-ec2-security-group]', :ec2_security_group_owner_id => '[our-aws-account-number]')
db = rds.create_db_instance(:db_instance_identifier => "[FILTERED]", :allocated_storage => 100, :db_instance_class => "db.m1.small", :engine => "MySQL5.1", :master_username => '[FILTERED]', :master_user_password => '[FILTERED]', :db_name => '[FILTERED]', :availability_zone => 'us-east-1c')
db = rds.create_db_instance(
:db_instance_identifier => "[FILTERED]",
:allocated_storage => 100,
:db_instance_class => "db.m1.small",
:engine => "MySQL5.1",
:master_username => '[FILTERED]',
:master_user_password => '[FILTERED]',
:db_name => '[FILTERED]',
:availability_zone => 'us-east-1c'
)