Skip to content

Instantly share code, notes, and snippets.

// This is my handler in the javascript
var uploadCompleteHandler = function(upload_options,event){
$.ajax({
url: '<%= notify_rails_of_successful_upload_path(:format => :js)%>',
global: false,
type: 'POST',
data: ({
'authenticity_token' : '<%= form_authenticity_token %>',
'upload' : {
'file_file_name' : upload_options.FileName,
@Epictetus
Epictetus / uploads_controller.rb
Created January 1, 2012 10:48 — forked from tpope/uploads_controller.rb
Carrierwave on Heroku
class UploadsController < ApplicationController
def show
headers['Cache-Control'] = 'public; max-age=600'
send_file Rails.root.join("tmp/uploads/#{params[:path]}"), :disposition => 'inline'
end
end
SPモードメールプロトコル
------------------------
< サーバーのレスポンス
> クライアントのリクエスト
---
< 220 ESMTP Server Ready
> EHLO mail.spmode.ne.jp
@Epictetus
Epictetus / gist:1517772
Created December 24, 2011 16:47 — forked from vijaydev/gist:1472145
Rails 3.2.0 Changelogs

The latest release notes is available at http://edgeguides.rubyonrails.org/3_2_release_notes.html

Railties 3.2.0 (unreleased)

  • Speed up development by only reloading classes if dependencies files changed. This can be turned off by setting config.reload_classes_only_on_change to false. José Valim

  • New applications get a flag config.active_record.auto_explain_threshold_in_seconds in the environments configuration files. With a value of 0.5 in development.rb, and commented out in production.rb. No mention in test.rb. fxn

  • Add DebugExceptions middleware which contains features extracted from ShowExceptions middleware José Valim

Attribute VB_Name = "JavaModule"
Option Explicit
''' Java コンパイル
Public Sub JavaCompile()
CompileAndRun True
End Sub
@Epictetus
Epictetus / rspec_in.php
Created December 21, 2011 10:10 — forked from everzet/rspec_in.php
Why RSpec is not possible in PHP
<?php
/*
Why i think, that "RSpec is not possible in PHP"?
Cuz Ruby's syntax abilities can represent
natural language constructions:
object should equals 2
ja:
errors:
messages:
not_found: "は見つかりませんでした"
# not_found: "not found"
already_confirmed: "は既に登録済みです"
# already_confirmed: "was already confirmed"
not_locked: "は凍結されていません"
# not_locked: "was not locked"
@Epictetus
Epictetus / gist:1500658
Created December 20, 2011 07:32 — forked from vijaydev/gist:1472145
Rails 3.2.0 Changelogs

Railties 3.2.0 (unreleased)

  • Speed up development by only reloading classes if dependencies files changed. This can be turned off by setting config.reload_classes_only_on_change to false. José Valim

  • New applications get a flag config.active_record.auto_explain_threshold_in_seconds in the environments configuration files. With a value of 0.5 in development.rb, and commented out in production.rb. No mention in test.rb. fxn

  • Add DebugExceptions middleware which contains features extracted from ShowExceptions middleware José Valim

  • Display mounted engine's routes in rake routes Piotr Sarnacki

var kue = require('kue'),
redis = require('redis'),
url = require('url');
kue.redis.createClient = function() {
var options = { host: 'localhost' };
if (process.env.REDISTOGO_URL) {
var redisUri = url.parse(process.env.REDISTOGO_URL);
options = {
host: redisUri.hostname,
// This is my handler in the javascript
var uploadCompleteHandler = function(upload_options,event){
$.ajax({
url: '<%= notify_rails_of_successful_upload_path(:format => :js)%>',
global: false,
type: 'POST',
data: ({
'authenticity_token' : '<%= form_authenticity_token %>',
'upload' : {
'file_file_name' : upload_options.FileName,