Skip to content

Instantly share code, notes, and snippets.

@sudar
sudar / index.php
Created August 19, 2011 16:37
A very simple PHP script to query YQL
<html>
<head>
<title>PHP Workshop</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>PHP Workshop</h1>
<p id = "special">The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
</p>
@sudar
sudar / 1
Created August 24, 2011 14:16
[gist id = "{GIST_ID}" file = "{GIST_FILE}"]
@sudar
sudar / unselect.html
Created September 23, 2011 16:03
Making some text unselectable in browser. More details at http://sudarmuthu.com/blog/making-text-unselectable-in-browser
<html>
<head>
<title>Making text unselectable</title>
<style>
body {
*-moz-user-select: none;
*-khtml-user-select: none;
*user-select: none;
}
.unselectable {
@sudar
sudar / gist:1289281
Created October 15, 2011 08:37
Access YQL in YUI
<html>
<head>
<title></title>
<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
<script type="text/javascript">
YUI().use('node', 'yql', function(Y) {
var res = Y.one('#res'),
zip = '90210';
@sudar
sudar / deploy.sh
Created October 15, 2011 09:26
rsync command to sync two folders
# rsync command to sync two folders
rsync --verbose --progress --stats --compress --rsh=ssh \
--recursive --times --links -u --rsh='ssh -p8023' \
--exclude "*.sh" --exclude "*~" --exclude "*.svn" --exclude "*.git" --exclude "nbproject" --exclude ".DS_Store" \
/path/to/local/file/ myserver.org:/path/in/remote/server/
@sudar
sudar / save-as.php
Created January 16, 2012 13:32
Generating dynamic files for download from PHP. More details at http://sudarmuthu.com/blog/generating-dynamic-files-for-download-from-php
<?php
if (isset($_POST['text']) && $_POST['text'] == 'saveastext') {
// some condition on which we should trigger this
header('Content-Type: text/plain'); // you can change this based on the file type
header('Content-Disposition: attachment; filename="readme.txt"');
// echo the file contents
exit();
}
?>
@sudar
sudar / wedding-invitation.js
Created January 18, 2012 11:52
The program that changed my life ;)
/**
* The program that changed my life ;)
*
* @author: Sudar Muthu (http://sudarmuthu.com)
*/
(function () {
var Sudar = new Person("Sudar"),
Archana = new Person("Archana");
@sudar
sudar / yql.dart
Created April 21, 2012 09:02
Calling YQL from Dart
// Using YQL in Dart
XMLHttpRequest request = new XMLHttpRequest();
String baseurl = "http://query.yahooapis.com/v1/public/yql?format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&q=";
String query = ''' select * from twitter.search where q="${_search.value}" ''';
request.open("GET", baseurl + encodeURI(query), true);
request.on.load.add((e) {
_result.hidden = false;
@sudar
sudar / mk_arduino_tags.sh
Created May 3, 2012 15:30 — forked from dcrosby42/mk_arduino_tags.sh
Shell script to generate Arduino ctags
ctags -f tags.cpp `find . -name "*.cpp" -o -name "*.h"`
ctags -f tags.pde --langmap=c++:.pde `find . -name "*.pde"`
cat tags.cpp tags.pde > tags
sort tags -o tags
rm -f tags.*
@sudar
sudar / gist:2841480
Created May 31, 2012 06:24
Get gist-it source
git clone git://github.com/sudar/gist-it.git
git branch plugin