Skip to content

Instantly share code, notes, and snippets.

View hindenbug's full-sized avatar
💻

Manoj hindenbug

💻
View GitHub Profile
@hindenbug
hindenbug / test.clj
Created January 5, 2014 20:24 — forked from adambard/test.clj
; Comments start with semicolons.
; Clojure is written in "forms", which are just
; lists of things inside parentheses, separated by whitespace.
;
; The clojure reader assumes that the first thing is a
; function or macro to call, and the rest are arguments.
;
; Here's a function that sets the current namespace:
(ns test)
@hindenbug
hindenbug / test.clj
Created January 4, 2014 20:33 — forked from adambard/test.clj
; Comments start with semicolons.
; Clojure is written in "forms", which are just
; lists of things inside parentheses, separated by whitespace.
;
; The clojure reader assumes that the first thing is a
; function or macro to call, and the rest are arguments.
;
; Here's a function that sets the current namespace:
(ns test)
;; eg: symbols in clojure, points to a verb or other values
;; when clojure evaluates a symbol it looks up that symbols meaning
inc
;; refer to symbols without evaluating its meaning
;; ' escapes a expression. Quote anything and get it back exactly
;; the same
'inc
@hindenbug
hindenbug / milestone1.md
Last active December 31, 2015 23:29
Clojure Adventures - MileStone 1
  • Clojure, the core data structures aren't mutable

Clojure Data Structures

Clojure has two types of expressions atoms and collections

ATOMS

Atoms represent Primitive Types in other languages, like:
Numbers, Strings, Boolean, Nil, Symbols, Keywords

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/manoj/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.6
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
@hindenbug
hindenbug / heisenbug
Created October 27, 2013 15:52
rstat.us heisenbug as requested for https://github.com/hotsh/rstat.us/issues/479
Start of Heisenbug logging ======================================
# Logfile created on 2013-10-27 21:17:25 +0530 by logger.rb/31641
Started GET "/users/user_273" for 127.0.0.1 at 2013-10-27 21:17:25 +0530
Processing by UsersController#show as HTML
Parameters: {"id"=>"user_273"}
Rendered shared/sidebar/_gravatar.haml (0.1ms)
Rendered shared/_pagination.haml (0.0ms)
Rendered updates/_list.html.haml (0.3ms)
Rendered users/show.haml within layouts/application (5.7ms)
Rendered shared/_head.html.haml (0.9ms)
1) PYTHON
2) CLOJURE
3) SCALA
4) HASKELL
5) Node.js
@hindenbug
hindenbug / gist:1578969
Created January 8, 2012 16:55
ruby-debug with ruby 1.9.3
###In order to use ruby-debug with ruby-1.9.3 you need to download the following from http://rubyforge.org/frs/?group_id=8883 ###
linecache19-0.5.13.gem
ruby_core_source-0.1.5.gem
ruby-debug19-0.11.6.gem
ruby-debug-base19-0.11.26.gem
###then from the terminal run,###
gem install ruby_core_source-0.1.5.gem -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p0
@hindenbug
hindenbug / gist:1096749
Created July 21, 2011 07:48
Using CSV Ruby 1.8 and Ruby 1.9
# in Gemfile
gem "fastercsv", :platforms => [:mri_18, :ruby_18]
# in app/config/environment.rb
require "csv"
unless !CSV.const_defined? :Reader
require "fastercsv"
l = "i am what i am"
# to integer
l.unpack('U*') # => [105, 32, 97, 109, 32, 119, 104, 97, 116, 32, 105, 32, 97, 109]
# to hex
l.unpack('H*') # => ["6920616d2077686174206920616d"]
# if you want the hex in array form then
l.unpack('U*').map{|i| i.to_s(16)} # => ["69", "20", "61", "6d", "20", "77", "68", "61", "74", "20", "69", "20", "61", "6d"]