Skip to content

Instantly share code, notes, and snippets.

Avatar

Jai Kumar jvkumar

  • San Francisco bay area, CA
View GitHub Profile
View 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,
View ben.php
<?
$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";
View gist:4543602
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
View comt
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
View schema.jason
template {
id: hash of (name,country,text,language,unixtimestamp)
name:
text:
html:
subject:
description:
country:
language:
is_active:
View api.json
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 Oct 10, 2012
github hook
View hook.sh
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 Oct 9, 2012
date monkey patching
View date.rb
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 Sep 14, 2012
Image postcard
View postcard.go
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
View mkf
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 }