Skip to content

Instantly share code, notes, and snippets.

View boddhisattva's full-sized avatar
🌷
Vasudhaiva Kutumbakam 🙂

Mohnish G J boddhisattva

🌷
Vasudhaiva Kutumbakam 🙂
View GitHub Profile
@boddhisattva
boddhisattva / Installing linecache19 - rvm ruby 1.9.3
Created November 22, 2012 16:50
Installing linecache19 gem on rvm ruby 1.9.3
I copied the gems to my box and installed them with the below command.. (it did take a while to install). Thus, please give it sometime before you think it might hang for ever.
mohnish@mohnish-laptop:~/xxxx/latest/prj_name/vendor/cache$ gem install ruby-debug19-0.11.6.gem -l
Building native extensions. This could take a while...
Building native extensions. This could take a while...
Successfully installed linecache19-0.5.12
Successfully installed ruby-debug-base19-0.11.25
Successfully installed ruby-debug19-0.11.6
3 gems installed
Installing ri documentation for linecache19-0.5.12...
@boddhisattva
boddhisattva / sample_barchart.html
Last active June 15, 2016 13:06
Sample Barchart with G Raphael
<!--<!doctype html>-->
<html lang="en">
<head>
<meta charset="utf-8">
<title>Static Bar Charts</title>
<link rel="stylesheet" href="css/demo.css" type="text/css" media="screen" charset="utf-8">
<link rel="stylesheet" href="css/demo-print.css" type="text/css" media="print" charset="utf-8">
<script src="https://raw.github.com/DmitryBaranovskiy/g.raphael/master/raphael-min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://raw.github.com/DmitryBaranovskiy/g.raphael/master/g.raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="https://raw.github.com/DmitryBaranovskiy/g.raphael/master/g.bar.js" type="text/javascript" charset="utf-8"></script>
@boddhisattva
boddhisattva / amcharts.js
Last active December 22, 2015 17:49
Sample AM Charts Column graph with X and Y Axis Labels
if(!AmCharts)var AmCharts={};AmCharts.inheriting={};
AmCharts.Class=function(a){var b=function(){arguments[0]!==AmCharts.inheriting&&(this.events={},this.construct.apply(this,arguments))};a.inherits?(b.prototype=new a.inherits(AmCharts.inheriting),b.base=a.inherits.prototype,delete a.inherits):(b.prototype.createEvents=function(){for(var a=0,b=arguments.length;a<b;a++)this.events[arguments[a]]=[]},b.prototype.listenTo=function(a,b,c){a.events[b].push({handler:c,scope:this})},b.prototype.addListener=function(a,b,c){this.events[a].push({handler:b,scope:c})},
b.prototype.removeListener=function(a,b,c){a=a.events[b];for(b=a.length-1;0<=b;b--)a[b].handler===c&&a.splice(b,1)},b.prototype.fire=function(a,b){for(var c=this.events[a],g=0,h=c.length;g<h;g++){var k=c[g];k.handler.call(k.scope,b)}});for(var c in a)b.prototype[c]=a[c];return b};AmCharts.charts=[];AmCharts.addChart=function(a){AmCharts.charts.push(a)};AmCharts.removeChart=function(a){for(var b=AmCharts.charts,c=b.length-1;0<=c;c--)b[c]==a&&b.splice(c,1)};A
@boddhisattva
boddhisattva / Hashes
Last active August 29, 2015 13:56
Hashes in Ruby
Total Months via hashes: 8
#{numbers["two"]}
zero
5
@boddhisattva
boddhisattva / Arrays
Last active August 29, 2015 13:56
Arrays in Ruby
1
6
Using size(above) n length(below) properties to print no. of elements in a string
6
tryin to print anything outside array bounds ..like value of a[8] prints nill.. do note..
11
note how through a[-3] we get the value of the third last element of the array 7
changing value of 1st element of array to 25.. and printing it.. note the way its printed..25
Dyanmically do note how the size of an array can be increased in Ruby..Making things simpler n Faster..and a programmer can't be happier.. Yukihiro Matsumto
value of a[6]: zero
@boddhisattva
boddhisattva / Hello World in Ruby
Created February 18, 2014 22:22
Helloworld program - Ruby
Hello World
@boddhisattva
boddhisattva / numbers in ruby
Last active August 29, 2015 13:56
Playing with numbers in Ruby
20
6
50
Subtraction of 50 - 30 is: 20
Exponentiation of 3^3 is: 27
Value of 5 modulo 3 is: 2
@boddhisattva
boddhisattva / User input in ruby.rb
Last active August 29, 2015 13:56
Taking User input in Ruby
print('HI..!! enter ur name please: ')
name = gets()
puts("Hello #{name}")
#this symbol is mainly used for comments.. what role is it playing here..??
# the hash symbol in the puts stmnt above within quotes can be used to print the value of the entity within the quotes
puts("\n")
#<<name
@boddhisattva
boddhisattva / Operators1.rb
Last active August 29, 2015 13:56
Operators in Ruby - Part 1
# Playing with operators in Ruby
limit = 5
p = 2 * Math.sqrt(4) < limit
puts(p)
k = 2 ** 4 # Exponentiation Operator..
puts(k)
@boddhisattva
boddhisattva / Operators2.rb
Created February 19, 2014 05:37
Operators in Ruby - Part 2
# Equality operators( '==' and check this '==='( case equality operator.. do note.. ) ).
a1 = 3
a2 = 4
a3 = 0
s1 = (a1==a2)
puts(s1)
s2 = (a3!=a2)