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
# Released to the public domain. | |
# Original implementation by François Beausoleil <[email protected]> | |
# Use at your own risks. | |
# This script will close ALL cases that match a certain criteria. | |
# Look below for CUSTOMIZE to see what needs changing. | |
# If you didn't know, this is Ruby, and was written when 1.8.6/1.8.7 was current. | |
# This script uses curl to do it's requesting, because Ruby cannot validate FogBugz's certificate. | |
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
setup do | |
logger.debug {"transaction setup"} | |
@__transaction = DataMapper::Transaction.new(DataMapper.repository(:default)) | |
logger.debug {"transaction begin"} | |
@__transaction.begin | |
end | |
teardown do | |
if @__transaction | |
logger.debug {"transaction rollback"} |
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 "logger" | |
if ENV.include?("RAILS_ENV") && !Object.const_defined?("RAILS_DEFAULT_LOGGER") | |
Object.const_set("RAILS_DEFAULT_LOGGER", Logger.new(STDOUT)) | |
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 SplitsController < ApplicationController | |
def update | |
transfers = [] | |
Transfer.transaction do | |
SyncEnumerator.new(params[:account_id], params[:amount]).each do |account_id, amount| | |
next if amount.blank? | |
transfers << transfer = current_family.transfers.build(:debit_account => current_family.accounts.find(account_id), :amount => amount) | |
transfer.bank_transactions << bank_transaction | |
transfer.save! | |
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 SplitsController < ApplicationController | |
def update | |
@split = Split.new(:account_ids => params[:account_id], :amounts => params[:amount], :family => current_family) | |
@split.save! | |
flash[:notice] = "#{transfers.length} transferts fûrent créés" | |
redirect_to bank_transactions_path | |
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
1) Error: | |
test_non_TA's_can_only_update_comments(CandidaciesControllerTest): | |
ActiveRecord::RecordNotFound: ActiveRecord::RecordNotFound | |
/Users/francois/Documents/work/soj-project/backstage/app/controllers/candidacies_controller.rb:193:in `find_employer' | |
/Users/francois/Documents/work/soj-project/backstage/vendor/plugins/aws-s3/lib/aws/s3/extensions.rb:134:in `returning' | |
/Users/francois/Documents/work/soj-project/backstage/app/controllers/candidacies_controller.rb:192:in `find_employer' | |
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
(defn process [socket] | |
(let [ in (java.io.PushbackReader. (make-reader (. socket getInputStream))) | |
out (java.io.PrintWriter. (make-writer (. socket getOutputStream)))] | |
(loop [stack ()] | |
(let [form (read in)] | |
(println "STACK:\t" stack) | |
(println "READ:\t" form) | |
(cond | |
(number? form) (recur (conj stack form)) | |
(= 'quit form) (do |
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 status "this is my status") | |
(def rdr (java.io.PushbackReader. (java.io.StringReader. status))) | |
(distinct | |
(loop [words []] | |
(let [word (read rdr false nil)] | |
(if (word) | |
(recur (conj words word)) | |
words)))) | |
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
~/Documents/work/twitter-word-cloud (master) $ clj | |
Clojure | |
user=> (ns twitter.reader | |
(:require [clojure.zip :as zip] | |
[clojure.xml :as xml] | |
[clojure.contrib.zip-filter :as zf]) | |
(:use clojure.contrib.zip-filter.xml | |
clojure.contrib.duck-streams)) | |
nil | |
twitter.reader=> |
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
# mod_cache, mod_disk_cache configuration | |
CacheRoot /mnt/apache/cache | |
CacheEnable disk / | |
CacheDirLevels 3 | |
CacheDirLength 2 | |
CacheMinFileSize 128 | |
# 20 Mb | |
CacheMaxFileSize 20971520 | |
# Remove extraneous information from the response |
OlderNewer