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
(ns tmp2) | |
(def data [1 1 2 3 2 1 1]) | |
(def data2 [1 2 1 3 1 2 4]) | |
( #(reduce (fn [acc el] | |
(if-not (some #{el} acc) | |
(conj acc el) | |
acc)) |
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
Podcasts: | |
Ruby Rogues - http://rubyrogues.com/ | |
Ruby5 - http://ruby5.envylabs.com/ | |
FunctionalGeekery - http://www.functionalgeekery.com/ | |
Screencasts: | |
Destroy all software - https://www.destroyallsoftware.com/screencasts | |
Ruby Tapas - http://www.rubytapas.com/ | |
News: |
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
;; Anything you type in here will be executed | |
;; immediately with the results shown on the | |
;; right. | |
(def name ["Tom" "David" "Crinson"]) | |
(str (nth name 2) ", " | |
(nth name 0) " " | |
(nth name 1)) |
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
$- > | |
initializeLinkSearch() | |
initializeLinkSearch = -> | |
$("#search").keyup -> | |
resetLinks() | |
displayLinksMatching searchTerm() | |
resetLinks = -> | |
links = $('.links li a') |
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 query-params [] | |
(into-array String ["?col1" "?col2"])) | |
(defn column-names [] | |
(into-array String ["col1" "col2"])) | |
; Becomes the 'where' part of the UPDATE statement - use primary key for example | |
(defn update-params [] | |
(into-array String ["?col1"])) |
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
(ns paduka.db_tap | |
(:use cascalog.api) | |
(:require [cascalog [vars :as v] [ops :as c] [workflow :as w]] | |
[clojure.string :as s]) | |
(:import [com.twitter.maple.jdbc JDBCScheme JDBCTap TableDesc] | |
[cascading.tuple Fields]) | |
(:gen-class)) | |
(defn mysql-tap [] | |
(let [scheme (JDBCScheme. (Fields. (into-array String ["id" "screen_name" "content"])) (into-array String ["id" "screen_name" "content"])) |
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 Wrapper | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def wrap! | |
class << self |
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
desc "Show off odd trap behaviour" | |
task :trap do | |
trap("INT") { puts "trapped INT"; exit(true) } | |
at_exit { puts "here" } | |
puts "sleeping" | |
sleep 10 | |
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
# jruby 1.6.7 (ruby-1.9.2-p312) | |
require 'open-uri' | |
a = open("http://pinterest.com/pin/56295064062363076/").read | |
a.encoding | |
=> #<Encoding:UTF-8> | |
b = StringIO.new(a).read | |
b.encoding | |
=> #<Encoding:ASCII-8BIT> | |
Encoding.default_internal |
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
SingleColumnValueFilter.new (Bytes.toBytes('data'), Bytes.toBytes('followers_count'), CompareFilter::CompareOp.valueOf('GREATER_OR_EQUAL'),BinaryComparator.new(Bytes.to_bytes(10))) |
NewerOlder