Skip to content

Instantly share code, notes, and snippets.

View jvkumar's full-sized avatar

Jai Kumar jvkumar

  • San Francisco bay area, CA
View GitHub Profile
@jvkumar
jvkumar / quote.json
Last active October 5, 2016 03:06
quote json
IMPORTANT: ALL AMOUNT VALUES (DOLLAR) WILL BE RETURNED IN CENTS
================================================================
{
"_id": "kuhi7fn7n8b7ow827y99w",
"property_id": 22354,
"is_multidimensional": true,
"furnishing_elected_flag": true,
"pet_elected_flag": true,
"parking_elected_flag": true,
<?
$restart_output="";
$status_output="";
$handle = @fopen("./{$server}.txt", "r");
if ($handle) {
while (($buffer = fgets($handle, 4096)) !== false) {
$this_server = trim($buffer);
$restart_output .= system("/var/www/cgi-bin/server_services.bash $this_server restart");
echo "$restart_output";
def symbolize!
convertor =
lambda do |h|
if Hash === h
Hash[
h.map do |k, v|
[k.respond_to?(:to_sym) ? k.to_sym : k, convertor[v]]
end
]
elsif Array === h
@jvkumar
jvkumar / comt
Created December 3, 2012 19:39
cmt
Jais-MacBook-Pro:bifrost jai$ git log
commit 8b84f41f52fb4e4c77d559b734af1a4ef825262d
Author: Jai Kumar <jai.kumar@memeo-inc.com>
Date: Mon Dec 3 11:29:30 2012 -0800
added orgid in id hash building
commit 3d2fbed2303d5015d1bbcf34ba4c3f64b60cfdf4
Author: Jai Kumar <jai.kumar@memeo-inc.com>
Date: Mon Dec 3 11:12:18 2012 -0800
@jvkumar
jvkumar / schema.jason
Created November 27, 2012 18:46
email template
template {
id: hash of (name,country,text,language,unixtimestamp)
name:
text:
html:
subject:
description:
country:
language:
is_active:
@jvkumar
jvkumar / api.json
Created October 23, 2012 18:43
Packagedb
GET /packages/latest?os=windows
-------------------------------
[{
"required": "1.0.0.80",
"product": "thoragent",
"target": "testing",
"os": "windows",
"id": 327,
"requiredurl": "http://com.memeo.magni.dl.s3.amazonaws.com/thoragent/MemeoC1Agent-1.0.0.80.zip",
@jvkumar
jvkumar / hook.sh
Created October 10, 2012 22:01
github hook
On Mac OS (or, likely, any BSD), the sed command parameters have to be slightly different. Try this:
#!/bin/sh
if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@jvkumar
jvkumar / date.rb
Created October 9, 2012 23:47
date monkey patching
require 'date'
class Date
class << self
alias_method :original_parse, :parse
end
def self.parse(str='-4712-01-01', comp=true,start=ITALY)
if str == '0000-00-00 00:00:00'
str = '1970-01-01 00:00:00'
end
self.original_parse(str, comp, start)
@jvkumar
jvkumar / postcard.go
Created September 14, 2012 23:33
Image postcard
Today is my second day of golang learning. I have gone through all the exercises of go tutorial on http://tour.golang.org/ and I am trying to write a simple program to overlap one image on another. My goal is to have an image (called background image) and then paste two images on top of it with given x, y, and z axis value with some angle (rotation).
I have skeleton of my first golang code below. I am freaking out as how to proceed. Any help or example of code will be greatly appreciated.
===========================================
package main
func main() {
//ASSUMPTION: All images will be jpg and much smaller compare to background image and they will never go outside the background image
@jvkumar
jvkumar / mkf
Created August 19, 2012 23:05
All info
Model: posts.rb
-----------
class Post
include Mongoid::Document
include Mongoid::Slug
field :name, type: String
field :title, type: String
field :content, type: String
validates :title, :presence => true, :length => { :minimum => 10 }