Skip to content

Instantly share code, notes, and snippets.

View wilkes's full-sized avatar

Wilkes Joiner wilkes

View GitHub Profile
(defn fact2 [x]
(let [x (if (<= x 1) 1 x)]
(apply * x (range 1 x))))
(defn perfect-number? [x]
(and (> x 0)
(== (apply + (filter #(= (rem x %) 0) (range 1 (inc x))))
x)))
(defn list-perfs [num]
(filter perfect-number? (range num)))
(defn current-iterations [projects-and-iterations]
(current-by
"Project"
(map (fn [[p [i]]]
{(-> p :project :name)
(-> i :iteration :stories)})
projects-and-iterations)))
# terminal
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo " ☠ "
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
export PS1='\u@\h \W$(__git_ps1 "|")$(parse_git_branch)$ '
#export PS1='\u@\h \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ '
/*
* AppController.j
* scrollview
*
* Created by You on November 2, 2009.
* Copyright 2009, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
/*
* AppController.j
* scrollview
*
* Created by You on November 2, 2009.
* Copyright 2009, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
var GoogleChartURL = "http://chart.apis.google.com/chart",
CPGoogleVeriticalStackedBarChart = @"bvs",
CPGoogleHorizontalStackedBarChart = @"bhs"
CPGoogleVeriticalGroupedBarChart = @"bvs",
CPGoogleHorizontalGroupedBarChart = @"bhs",
CPGoogleLineChart = @"lc",
CPGooglePieChart = @"p",
CPGooglePieChart3D = @"p3";
...
(defn is-in? [v vs]
(some #{true} (map #(= % v) vs)))
(ns floyd.reports
(:use [clojure.contrib.seq-utils :only [includes?]]
[floyd.formatters :only [billing-minutes billing-seconds as-minutes]]
[floyd.str-utils :only [join-str to-display-str]]))
(defparseable column-descriptor
[:table-column {:required true}]
[:name {:type :pair :default :table-column}]
[:label {:type :pair :default (fn [this] (to-display-str (:name this)))}]
[:calc {:enums #{:sum :avg :count}}]
:formatted-report (run-report
(build-query (parse-report billing)
{"call_date_start" startdate
"call_date_end" enddate
"main_account_number_equals" account})
billing-formatter)