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
DateFormat indiaDtFmt = new SimpleDateFormat("dd/MM/yyyy HH'h'mm"); | |
DateFormat gmtDtFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
indiaDtFmt.setTimeZone(TimeZone.getTimeZone("Asia/Calcutta")); | |
gmtDtFmt.setTimeZone(TimeZone.getTimeZone("GMT")); | |
Date worldWarIIDate = indiaDtFmt.parse("02/02/1944 06h30"); | |
Date nonWorldWarIIDate = indiaDtFmt.parse("02/02/2006 06h30"); | |
System.err.println(gmtDtFmt.format(worldWarIIDate) +" GMT"); |
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
#1. Print Hello World | |
puts "Hello World." | |
#2. Index of "Ruby" | |
puts "Hello Ruby".index("Ruby") | |
#3. Name 10 times | |
puts "Srikanth#{$/}" * 10 | |
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
Print array 4 elements each time | |
[*(1..16)].each { |v| v%4==0? p(v) : print("#{v},")} |
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 ActsAsCsv | |
def self.included(base) | |
base.extend ClassMethods | |
base.act_as_csv | |
end | |
module ClassMethods | |
def act_as_csv | |
include InstanceMethods |
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
#!/usr/bin/env io | |
Vehicle := Object clone | |
Vehicle desc := "Moving Object" | |
Car := Vehicle clone | |
Car drive := method ("Vrooom..." println) | |
ferrari := Car clone | |
Car drive | |
Car slotNames println |
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
list( list(2,3) list(3,4,5) list(6)) flatten sum |
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
#!/usr/bin/env io | |
OperatorTable addAssignOperator(":", "genAttribute") | |
Builder := Object clone | |
Builder genAttribute := method(k,v, | |
k = k asMutable removePrefix("\"") removeSuffix("\"") | |
write(" "..(k)..("=\"")..(v).."\"") ) | |
Builder curlyBrackets := method( |
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
#!/opt/local/bin/gprolog --consult-file | |
book('Seven langauges in seven days','Bruce tate'). | |
book('Beyond Java','Bruce tate'). | |
book('Bitter Java','Bruce tate'). | |
book('Spring Developer Note Book','Bruce tate'). | |
book('C programming language','Ritchie','Kernighan'). | |
book('Practice Of Programming','Kernighan','Pike'). | |
book('Unix Programming Environment','Pike','Kernighan'). |
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
#!/opt/local/bin/gprolog --consult-file | |
rev([X],[X]). | |
rev([H|T],RL) :- rev(T,RT), append(RT,[H],RL). |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading; | |
namespace TimerDeferredEval | |
{ | |
class JobScheduler : IDisposable | |
{ | |
private static readonly TimeSpan DueTime = new TimeSpan(0, 0, 0, 5); |
OlderNewer