Skip to content

Instantly share code, notes, and snippets.

View girishso's full-sized avatar

Girish Sonawane girishso

  • Pune, India
View GitHub Profile
@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!
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
<!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>
/** @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);
<? echo "Hello World!" ?>
###### Usage #######
#
#
# rails blog -m http://gist.github.com/raw_path
#
#
###################
############## generate commands #################
$(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;
});