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' | |
require 'pathname' | |
get %r{^(?!/files)(.+$)} do |path| | |
dir = './public/files' + path | |
pass unless File.exists?(dir) | |
@links = Dir[ dir + '*' ].map do |file| | |
url = file.gsub %r{^\./public}, '' | |
file_link( File.directory?( file ) ? url.gsub( %r{^/files}, '' ) + '/' : url ) | |
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
class Proc | |
def in_discomfort?; :me; end | |
end | |
you_are = you = | |
->(you) do | |
self.inspect until true |
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 ruby | |
# usage: | |
# $ das_download.rb email password [download_directory] | |
require 'mechanize' | |
# gem 'mechanize-progressbar' | |
email = ARGV[0] or raise('Please provide the email address for your account') | |
password = ARGV[1] or raise('Please provide the password for your account') | |
path = ARGV[2] || './' |
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
/* | |
* jQuery XHR upload plugin | |
* http://github.com/maca | |
* | |
* Copyright 2011, Macario Ortega | |
* Dual licensed under the MIT or GPL Version 2 licenses. | |
* | |
*/ | |
(function($){ |
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
/* | |
* jQuery XHR upload plugin | |
* http://github.com/maca | |
* | |
* Copyright 2011, Macario Ortega | |
* Dual licensed under the MIT or GPL Version 2 licenses. | |
* | |
*/ | |
(function($){ |
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
<!-- Sorry, this example is with formtastic but I think it would work the same with vanilla rails form helpers --> | |
<%= semantic_form_for @survey do |form| %> | |
<fieldset class="nested_models answers" data-association="answers"> | |
<%- form.object.answers.build %> | |
<%= form.semantic_fields_for :answers do |answer| %> | |
<%- record = answer.object %> | |
<fieldset class="<%= record.new_record? ? :new : nil %>"> |
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 | |
## my own rsync-based snapshot-style backup procedure | |
## (cc) marcio rps AT gmail.com | |
## modified by github.com/maca | |
lock=/tmp/snapshot-lock | |
if [ -f $lock ] ; then | |
echo "snapshot: a lock file seems to exist $lock" | |
exit | |
fi |
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
/* | |
* jQuery XHR upload plugin | |
* http://github.com/maca | |
* | |
* Copyright 2011, Macario Ortega | |
* Dual licensed under the MIT or GPL Version 2 licenses. | |
* | |
*/ | |
(function($){ |
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 'bundler' | |
run "echo TODO > README.rdoc" | |
wants_bootstrap = yes? 'Do you want to use bootstrap?' | |
wants_devise = yes? 'Do you want to use devise?' | |
if wants_devise | |
devise_model = ask 'What would you like your devise model to be?' | |
devise_model_fields = ask 'Yo can optionally provide additional params for the devise model (eg. name:string)' | |
end |
OlderNewer