Skip to content

Instantly share code, notes, and snippets.

Andrew Cholakian andrewvc

Block or report user

Report or block andrewvc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andrewvc
andrewvc / count-clj-sloc.sh
Created Jul 23, 2012
Counting SLOC in clojure is pretty easy since the syntax is so simple.
View count-clj-sloc.sh
# Count SLOC
export SLF=`mktemp -t cljsloc`; find src test -name "*.clj" | xargs egrep -v "(^[[:space:]]*$|^[[:space:]]*;)" | cut -d: -f1 > $SLF && echo "Files"; uniq -c $SLF; echo "Total" `cat $SLF | wc -l`; rm $SLF
@fogus
fogus / gist:2765987
Created May 22, 2012 — forked from sviperll/gist:2762734
My thoughts on new programming language
View gist:2765987

I have been thinking a lot about implementing functional lazy language targeting JVM with syntax like:

class Maybe a = Just a | Nothing
  implements Monad, Eq when a implements Eq, Ord when a implements Ord
  where {
    derive Ord;
    derive Eq;
    
    override {
@davidrupp
davidrupp / jetty.clj
Created Oct 29, 2011 — forked from minimal/jetty.clj
Websockets with clojure + jetty
View jetty.clj
;; Copyright (c) James Reeves. All rights reserved.
;; The use and distribution terms for this software are covered by the Eclipse
;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which
;; can be found in the file epl-v10.html at the root of this distribution. By
;; using this software in any fashion, you are agreeing to be bound by the
;; terms of this license. You must not remove this notice, or any other, from
;; this software.
(ns compojure.server.jetty
"Clojure interface to start an embedded Jetty server."
View alephNoir.clj
(require '[noir.server :as server])
(use 'noir.core 'aleph.http 'lamina.core)
(defn async-response [response-channel request]
(enqueue response-channel
{:status 200
:headers {"content-type" "text/plain"}
:body "async response"}))
(defpage "/" [] "hey from Noir!")
@ZJONSSON
ZJONSSON / index.html
Created Oct 1, 2011
Using data() enter and exit in D3
View index.html
<!DOCTYPE html>
<html>
<head></head>
<body></body>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript">
// Define the SVG domain in a viewbox to get automatic resize to
// window. This is a good alternative to d3.scale for simple stuff
svg=d3.select("body")
@michiakig
michiakig / ants.clj
Created Jul 19, 2011
Clojure ant sim from Rich Hickey
View ants.clj
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world
@nesquena
nesquena / index_users_emails.rb
Created Jul 14, 2011
Add concurrent index in Postgres Rails migration
View index_users_emails.rb
class IndexUsersEmails < ActiveRecord::Migration
def self.up
execute "END"
add_pg_index :users, :email, :lock => false
execute "BEGIN"
end
end
@mza
mza / validate.rb
Created May 6, 2011
Really simple CloudFormation template validation
View validate.rb
require 'rubygems'
require 'fog'
require 'yaml'
config = YAML::load_file(File.dirname(__FILE__) + '/config.yml')
cf = Fog::AWS::CloudFormation.new(
:aws_access_key_id => config['key'],
:aws_secret_access_key => config['secret']
)
@ibdknox
ibdknox / socket.clj
Created Oct 31, 2010
compojure with websockets
View socket.clj
(ns wl.core
(:use compojure.core, aleph.core, aleph.http, hiccup.core, hiccup.page-helpers)
(:require [compojure.route :as route])
(:gen-class))
(def broadcast-channel (channel))
(defn chat-handler [ch handshake]
(receive ch
(fn [name]
You can’t perform that action at this time.