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
find . -name *.rb | xargs perl -i.orig -pe 'print "# encoding: utf-8\n" if $. == 1; close ARGV if eof' |
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
namespace :db do | |
namespace :sessions do | |
desc "Clean up expired Active Record sessions (updated before ENV['UPDATED_AT'], defaults to 1 month ago)." | |
task :expire => :environment do | |
time = Time.parse( ENV['UPDATED_AT'] || 1.month.ago.to_s(:db) ) | |
say "cleaning up expired sessions (older than #{time}) ..." | |
session = ActiveRecord::SessionStore::Session | |
rows = session.delete_all ["updated_at < ?", time] | |
say "deleted #{rows} session row(s) - there are #{session.count} session row(s) left" | |
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
module AlertConfirmer | |
class << self | |
def reject_confirm_from &block | |
handle_js_modal 'confirm', false, &block | |
end | |
def accept_confirm_from &block | |
handle_js_modal 'confirm', true, &block | |
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
git config --unset-all core.ignorecase && git config --system core.ignorecase false |
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 ./index | |
#= require jquery.fileupload/js/jquery.fileupload | |
class app.classes.FileUploader | |
constructor: (@root) -> | |
@url = jQuery(@root).attr('data-file-upload-path') | |
@bindings() | |
@flag = true | |
@count = 0 | |
bindings: => |
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
(function(old) { | |
jQuery.fn.attr = function() { | |
if(arguments.length === 0) { | |
if(this.length === 0) { | |
return null; | |
} | |
var obj = {}; | |
jQuery.each(this[0].attributes, function() { | |
if(this.specified) { |
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
def signature_to_img(data, filename) | |
return if data.blank? | |
FileUtils.mkdir_p(File.dirname(filename)) | |
instructions = JSON.parse(data).map { |h| "line #{h['mx'].to_i},#{h['my'].to_i} #{h['lx'].to_i},#{h['ly'].to_i}" }.join(' ') | |
Open3.popen3("convert -size 198x55 xc:transparent -stroke blue -draw @- #{filename}") do |input, output, error| | |
input.puts instructions | |
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
(($) -> | |
jQuery.fn.getPath = -> | |
throw "Requires one element." unless @length is 1 | |
path = undefined | |
node = this | |
while node.length | |
realNode = node[0] | |
name = realNode.localName | |
break unless name | |
name = name.toLowerCase() |
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 "#{Rails.root}/app/models/settings.rb" | |
config.assets.paths << "#{Rails.root}/app/themes/#{Settings.theme}/assets/stylesheets" | |
config.assets.paths << "#{Rails.root}/app/themes/#{Settings.theme}/assets/images" | |
config.assets.paths << "#{Rails.root}/app/themes/#{Settings.theme}/assets/javascripts" |
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
(function($) { | |
$.xpath = function(exp, ctxt) { | |
var item, coll = [], | |
result = document.evaluate(exp, ctxt || document, null, 5, null); | |
while (item = result.iterateNext()) | |
coll.push(item); | |
return $(coll); | |
} |