Skip to content

Instantly share code, notes, and snippets.

debug_http () {
curl $@ -o /dev/null -w "dns: %{time_namelookup} connect: %{time_connect}
pretransfer: %{time_pretransfer} starttransfer: %{time_starttransfer} total: %{time_total}\n" ;
}
import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;
import javax.swing.*;
public class app {
public static void main(String [] args) {
Window w = new Window();
w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
class Song
include MongoMapper::Document
plugin Grip
attachment :mp3
key :title, String
key :artist, String
key :album, String
key :genre, String
class SongsController < ApplicationController
def index
@songs = Song.all(:destroyed_at => nil)
@totals = load_totals(@songs)
end
def new
@song = Song.new
render :layout => false
class Event
include MongoMapper::Document
include MultiParameterAttributes
key :name, String, :required => true
key :start_date, Date, :required => true
key :start_time, Time, :required => true
end
class BaseModel < CouchRest::ExtendedDocument
include ActiveModel::Dirty
use_database DB
def initialize(passed_keys={}, options={})
super(passed_keys, options)
@changed_attributes = {}
end
class <<self
vendor/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json/encoding.rb:111:in `unpack'
vendor/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json/encoding.rb:111:in `escape'
vendor/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json/encoding.rb:106:in `gsub'
vendor/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json/encoding.rb:106:in `escape'
vendor/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json/encoding.rb:51:in `escape'
vendor/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json/encoding.rb:157:in `encode_json'
vendor/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json/encoding.rb:46:in `encode'
vendor/bundler/gems/rails-16a5e918a06649ffa
def create
@video = Video.new(params[:video])
if @video.save
@video.put_attachment('clip', params[:video][:file])
flash[:notice] = 'Video created succes!'
redirect_to admin_videos_path
else
flash[:notice] = 'Video created is fail!'
render :action => :new
class BaseModel < CouchRest::ExtendedDocument
include CouchRest::Validation
extend ActiveModel::Naming
include ActiveModel::Conversion
include Dirty
include Uniq
use_database DB
def create
attach = params[:video].delete(:file)
@video = Video.new(params[:video])
if @video.save
@video.put_attachment('clip', attach.read)
flash[:notice] = 'Video created succes!'
redirect_to admin_videos_path
else
flash[:notice] = 'Video created is fail!'