Skip to content

Instantly share code, notes, and snippets.

@octan3
octan3 / cookiecatcher.ps1
Created August 4, 2011 11:42
PowerShell HTTP Cookie Catcher (WebRequest, SSL Certificate Validation Check, Expect 100)
[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
[Net.ServicePointManager]::Expect100Continue = $false
$cc = new-object Net.CookieContainer
$req = [Net.WebRequest]::Create("https://www.example.com/service")
$req.CookieContainer = $cc
$req.Method = 'POST'
$req.Timeout = 5000
$req.ContentType = 'application/x-www-form-urlencoded'
@octan3
octan3 / json-parser.ps1
Created August 4, 2011 11:46
PowerShell JSON Parser (compact)
$code = "static function parseJSON(json) {return eval('(' +json + ')');}"
$JSONUtil = (Add-Type -Language JScript -MemberDefinition $code -Name "JSONUtil" -PassThru)[1]
$obj = $JSONUtil::parseJSON($jsonString)
@romannurik
romannurik / button_bar_layout.xml
Created April 10, 2012 04:24
How to make a proper button bar on ICS
<!--
A button bar is a set of buttons at the bottom of an activity.
An example is an AlertDialog with OK/Cancel buttons.
Note that something similar can be accomplished using a
split action bar and text-only action buttons, but this is an
alternate presentation that's often preferred.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"

this approach is based not on blocking some square on the screen, but rather blocking events from other device (after touch interaction mouse events are blocked for some period and vice versa)

note: its a draft for angular-hammer use, so one would need to modify it a little to use with native elements ( atm it accepts jQuery element and addresses dom via element[0] )