Skip to content

Instantly share code, notes, and snippets.

This is a test gits.
require 'net/http'
require 'uri'
# /api/v1/:format/new
# /api/v1/:format/gists/:user
# /api/v1/:format/:gist_id
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'),
{ 'files[file1.ab]' => 'CONTNETS',
'files[file2.ab]' => 'contents' })
MouseAdapter handler = new MouseAdapter() {
//Override methods
}
// Get all children of the combobox
Component c[] = combobox.getComponents();
for (int i =0; i < c.length; i++) {
// add event listener to all of the child components
c[i].addMouseListener(handler);
}
setListAdapter(new ArrayAdapter<string>(this, R.layout.list_item, strings) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row;
if (null == convertView) {
row = mInflater.inflate(R.layout.list_item, null);
} else {
row = convertView;
}
@sudar
sudar / yql.html
Created October 9, 2010 12:53
Code samples to access YQL. More details at http://sudarmuthu.com/blog/code-sample-to-access-yql
<html>
<head>
<title>YUI in YQL</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) {
Y.YQL('SELECT * FROM upcoming.events WHERE location = "Bangalore"', function(r) {
// process the result json object
WebView wv = (WebView) findViewById(R.id.wv1);
@sudar
sudar / dotdeb.sh
Created January 25, 2011 16:48
Adding dotdeb repository to apt-get source list to install PHP 5.3.x. More details at http://sudarmuthu.com/blog/2011/01/25/installing-php-5-3-x-in-ubuntu-through-apt-get-or-aptitude.html
gpg --keyserver keys.gnupg.net --recv-key 89DF5277
gpg -a --export 89DF5277 | sudo apt-key add -
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse(path);
sharingIntent.setType("image/png");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share image using"));
@sudar
sudar / gist:836170
Created February 20, 2011 18:17
.htaccess rule to change from date based permalinks to postname permalinks
RedirectMatch permanent ^/blog/[0-9]{4}/[0-9]{2}/[0-9]{2}/([a-z0-9-/]+) http://sudarmuthu.com/blog/$1
@sudar
sudar / AdjustVolume.java
Created March 5, 2011 10:27
Adjusting volume in Android. Explanation of the code can be found at http://sudarmuthu.com/blog/adjusting-the-volume-in-android-through-code
AudioManager audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);