I hereby claim:
- I am orip on github.
- I am orip (https://keybase.io/orip) on keybase.
- I have a public key whose fingerprint is 9CA5 31A3 696E BD84 88BC 5BED AC4C 56E0 A3A1 8161
To claim this, I am signing this object:
| // Available under the MIT license, http://opensource.org/licenses/MIT | |
| /** | |
| * Adapt between Context's file input/output streams and Guava's sinks and sources. | |
| * | |
| * This supports file modes. | |
| * | |
| * Usage: | |
| * ByteSink sink = | |
| * new AndroidPrivateFileGuavaAdapter( | |
| * "foo", Context.MODE_PRIVATE, context).asByteSink(); |
| import com.google.common.io.CharStreams; | |
| import java.io.BufferedReader; | |
| import java.io.IOException; | |
| import java.io.InputStreamReader; | |
| /** | |
| * Zero error checking or recovery. Apologies. | |
| * | |
| * Requires the READ_LOGS permission. |
I hereby claim:
To claim this, I am signing this object:
| // jQuery.validate.requiredIfVisible.js | |
| // Copyright (c) 2010 Ori Peleg, http://orip.org, distributed under the MIT license | |
| (function($) { | |
| $.validator.addMethod( | |
| "requiredIfVisible", | |
| function(value, element, params) { | |
| function isVisible(e) { | |
| // the element and all of its parents must be :visible | |
| // inspiration: http://remysharp.com/2008/10/17/jquery-really-visible/ | |
| return e.is(":visible") && e.parents(":not(:visible)").length == 0; |
| // jQuery plugins to focus a fragment | |
| // | |
| // Uses a StackOverflow-like "flashing" effect. | |
| // Degrades gracefully: assumes anchors have a fragment, so | |
| // the scrolling will work without JS. | |
| // | |
| // Written by Ori Peleg | |
| // Copyright (c) 2010 CloudShare, http://www.cloudshare.com/ | |
| // Distributed under the MIT license |
| # one-liner for generating a 14-char password | |
| # On Windows this is a secure password, based on CryptGenRandom | |
| # On *nix this is based on /dev/urandom which is intended to be a cryptographically-secure PRNG but | |
| # usually isn't. It should still be good enough for passwords. | |
| python -c "import random, string; r = random.SystemRandom(); print ''.join(r.choice(string.letters + string.digits) for i in xrange(14))" |
| /** | |
| * Create a compare function for Javascript's Array.sort() | |
| * Inspired by Triptych's http://stackoverflow.com/a/979325/37020 | |
| * | |
| * my_array.sort( sorter({key: 'size', reverse: true}) ); | |
| * my_array.sort( sorter({key: function(x) { return parseInt(x.tag); }) ); | |
| */ | |
| var sorter = function(spec) { | |
| if (spec.key === undefined) | |
| spec.key = function(x) { return x; }; // identity |
| .*.swp |
| console.log(JSON.stringify($('#error-sum-table .e').map(function(i, x) { | |
| var $x = $(x); | |
| var message = $x.find('.error-name').text().trim(); | |
| var count = parseInt($x.find('.counter').text().trim()); | |
| var filegroups = $x.find('.class-file').text().trim().match(/File: ([^ ]*)/); | |
| var appvers = $x.find('.app_version').map(function(i, x) { | |
| return $(x).text().trim(); | |
| }); | |
| var bugid = $x.find('.middle').data('id'); | |
| return { |
| #!/bin/sh | |
| # inspired by http://www.cimgf.com/2011/02/20/revisiting-git-tags-and-building/git_hash=`git rev-parse --short HEAD 2>/dev/null || echo "nohash"` | |
| TARGET_FILE=${PROJECT_TEMP_DIR}/InfoPlist.h | |
| echo "#define GIT_HASH $git_hash" > $TARGET_FILE | |
| touch $INFOPLIST_FILE |