Skip to content

Instantly share code, notes, and snippets.

View solarsailer's full-sized avatar

Matthieu Oger solarsailer

View GitHub Profile
private HttpClient client;
public HttpModule() {
client = new DefaultHttpClient();
}
public void executePost() {
HttpPost post = new HttpPost(APIConfiguration.getURL(Protocol.HTTPS, "user"));
Console.log(post.getURI());
@solarsailer
solarsailer / gist:953528
Created May 3, 2011 15:24
Recursively remove all .svn directories
find . -name .svn -print0 | xargs -0 rm -rf
@solarsailer
solarsailer / URLScheme Android
Created June 14, 2011 13:54
Basic implementation of URL scheme in Android
--- Manifest ---
<activity android:name=".URLScheme">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="http"
android:host="www.a_url.com"
android:pathPrefix="/a_path" />
@solarsailer
solarsailer / node-server.js
Created September 23, 2011 13:31
A simple server to do client-side scripting
#!/usr/bin/env node
var express = require('/usr/local/lib/node_modules/express');
var app = express.createServer();
// get the dir from the command line
const DIR = process.argv[2] || __dirname;
const PORT = process.argv[3] || 4242;
// a little bit of configuration...
app.configure(function() {
@solarsailer
solarsailer / background.xml
Created December 12, 2011 14:13
Google+ like page
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid
android:color="#fff" />
<padding
android:top="10dip"
android:right="10dip"
android:bottom="10dip"
@solarsailer
solarsailer / options-pattern.js
Created January 4, 2012 13:23
Merge options param to a defaults object (first draft)
/**
* Optional params pattern.
* Merge a user defined object with a default one.
*/
setOptions: function(defaults, options) {
/* Force the obj param to be an object literal */
if (typeof defaults !== 'object') defaults = {};
if (typeof options !== 'object') options = {};
/*
@solarsailer
solarsailer / parser.coffee
Created February 6, 2012 20:44
Simple doc parser
fs = require 'fs'
path = 'some_path.js'
fs.readFile path, 'utf-8', (err, data) ->
data.split('\n').forEach (line) ->
if line.indexOf('*') != -1
line = clean line
console.log line if line != ''
@solarsailer
solarsailer / osx_helpers.sh
Last active December 16, 2015 01:59
OSX Helpers
# Set the save dialog to be in extended mode by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
# Set the iCloud-using apps to not save to iCloud by default
# Courtesy of @room34, http://blog.room34.com/archives/5098
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Open a new document in TextEdit (& other iCloud-backed app) directly
# instead of presenting the document picker.
defaults write -g NSShowAppCentricOpenPanelInsteadOfUntitledFile -bool false
@solarsailer
solarsailer / template_full.cs
Created July 25, 2013 18:30
Full C# template
#region Nested
#endregion
#region Static
#endregion
#region Constants
#endregion
#region Members
@solarsailer
solarsailer / template_base.cs
Created July 25, 2013 18:31
Base C# template
#region Members
#endregion
#region Constructors
#endregion
#region Methods
#endregion
#region Properties