Skip to content

Instantly share code, notes, and snippets.

View girishso's full-sized avatar

Girish Sonawane girishso

  • Pune, India
View GitHub Profile
$(function() {
$('#add_new').click(function() {
TopUp.display($('#topup_div'),
{type: 'dom', title: 'New Todo',
overlayClose: 1, resizable: 0, shaded: 1});
});
$('#topup_frm').submit(function() {
$.post(this.action, $(this).serialize(), null, "script");
return false;
});
###### Usage #######
#
#
# rails blog -m http://gist.github.com/raw_path
#
#
###################
############## generate commands #################
<? echo "Hello World!" ?>
/** @jsx React.DOM */
var App = React.createClass({displayName: 'App',
getInitialState: function(){
return {html: "this is <em>an</em> <strong>example</strong>"};
},
render: function(){
var handleChange = function(event){
this.setState({html: event.target.value});
}.bind(this);
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'i18n', github: 'svenfuchs/i18n'
gem 'sqlite3'
GEMFILE
@girishso
girishso / parseXML.cs
Last active November 4, 2015 03:12
funniest code I've seen!
private void processAllHiddenTags(StringBuilder sbXMLString, ASMStudent student)
{
if (((sbXMLString.ToString().IndexOf("<w:body>") >= 0) && (sbXMLString.ToString().IndexOf("<w:body>") <= sbXMLString.Length)) &&
((((sbXMLString.ToString().IndexOf("</w:body>") - sbXMLString.ToString().IndexOf("<w:body>")) + 9) >= 0) &&
(((sbXMLString.ToString().IndexOf("</w:body>") - sbXMLString.ToString().IndexOf("<w:body>")) + 9) <= sbXMLString.Length)))
{
pageText = sbXMLString.ToString().Substring(sbXMLString.ToString().IndexOf("<w:body>"), (sbXMLString.ToString().IndexOf("</w:body>") - sbXMLString.ToString().IndexOf("<w:body>")) + 9).ToString().Trim();
//
// more madness follows!
@girishso
girishso / esakal.sh
Created January 11, 2016 06:54
Little script that runs every morning on my raspberry pi and emails me the movies page from esakal!
#!/bin/bash
link="http://epaper3.esakal.com/%s/Enlarge/PuneCity/Pune1Today/page%s.htm"
html_file7="/var/log/esakal.htm7"
html_file8="/var/log/esakal.htm8"
url=""
# cf. "Editing files with the ed text editor from scripts.",
# http://wiki.bash-hackers.org/doku.php?id=howto:edit-ed
#define HC_DATA_H digitalWrite(data, HIGH) // data line output high
#define HC_DATA_L digitalWrite(data, LOW) //date line output low
#define HC_RCK_H digitalWrite(rck, HIGH) // rck output high
#define HC_RCK_L digitalWrite(rck, LOW) // rck output low
#define HC_SCK_H digitalWrite(sck, HIGH) // sck output high
#define HC_SCK_L digitalWrite(sck, LOW) // sck output low
unsigned char LED_BCD[16] ={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e }; //common anode digital tube BCD code
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
# Activate the gem you are reporting the issue against.