Skip to content

Instantly share code, notes, and snippets.

View sivabudh's full-sized avatar

Sivabudh Umpudh sivabudh

View GitHub Profile
@sivabudh
sivabudh / scheduler.rb
Created June 26, 2012 08:49
Implementation of the implementation we talked about yesterday.
require 'chronic'
class Scheduler
def self.process(params)
raise 'start_date must be supplied' if params[:start_date].nil?
raise 'end_date must be supplied' if params[:end_date].nil?
raise 'occurs_on must be supplied' if params[:occurs_on].nil?
start_date = DateTime.parse params[:start_date]
end_date = DateTime.parse params[:end_date]
import java.awt.*;
import java.applet.Applet;
public class NestedLayoutApplet extends Applet
{
Panel southPanel;
Panel centerPanel;
TextField t;
public NestedLayoutApplet(){
String caption = "This example shows an Applet that "+
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(document).ready(function(){
fetchWorldStates();
});
require 'sinatra'
require 'sinatra/jsonp'
require 'json'
require 'sinatra/cross_origin'
set :port, 80
get '/' do
cross_origin
content_type :json
@sivabudh
sivabudh / CustomizeWindow.java
Created April 15, 2013 17:20
The code that should work
import java.awt.*;
import javax.swing.*;
public class CustomizeWindow extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
public static void main(String[]args){
@sivabudh
sivabudh / how_to_traverse_map.java
Last active December 16, 2015 21:39
An example of how to traverse a map.
public static void main(String[]args){
Map<Integer, String> map = new HashMap<Integer, String>();
map.put(5, "pac");
map.put(6, "got");
//
// Iterator
//
System.out.println("Iterator way");
Iterator it = map.entrySet().iterator();
@sivabudh
sivabudh / sample_loop
Created May 2, 2013 13:51
2 different ways to transform each element in an array.
# initial input
array = ["1", "2"]
# did you know that this code block?
final_array = array.map do | elm |
elm.to_i
end
# does the same thing as this code block?
final_array = [ ]
@sivabudh
sivabudh / java_vs_ruby_hashmap.java
Created May 2, 2013 14:02
Comparing Java & Ruby Hashmap
// Creating a HashMap in Java
Map<String, String> someMap = new HashMap<String, String>();
someMap.put("base_uri", "http://localhost:3000/users");
// Creating a hash map in Ruby
someMap = {
"base_uri": "http://localhost:3000/users"
}
Programming knowledge. Academic environment. English-speaking environment.
Since I am very interested in becoming a programmer in the future, I am looking for opportunities to learn more skills and gain experience. I think my problem is I still lack of time and advice, and I want to be put into those environment. I was a bit worried that even though I've been in ICE for two years, I still don't see a clear picture of how programmers work. App Pro kind of broadened my view, but I didn't feel that it was enough. I think if I don't continue to code, I might end up graduating and not being able to actually do anything. I also want to have some people to turn to, to discuss, ask for help or share ideas and give me motivations/inspirations. I have actually been looking for internships for the whole past semester because of those mentioned reasons. When Arjarn Pac told me that he was having this ideas of making this club/offering some work, I thought that finally I found exactly what I have been looking for.
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# Gems used only for assets and not required