This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage: | |
// your share intent | |
Intent intent = new Intent(Intent.ACTION_SEND); | |
intent.setType("text/plain"); | |
intent.putExtra(Intent.EXTRA_TEXT, "some text"); | |
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "a subject"); | |
// invoke custom chooser that contains all apps just without Facebook | |
startActivity(Tools.customChooserIntentNoFb(intent, "Share using", context)); | |
// Method: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- * attach functions to our existing cGame class. ('cGame:_blah') Use a preceeding underscore to make sure there is no name clash. | |
-- * access the game instance through 'g' | |
-- * access global exported C++ functions: | |
-- j_log( string ) | |
-- write to jserver log stream (you may not use '\n', a newline is appended automatically on each function call) | |
-- NOTE: for tablelog use g:log() and g:log_debug() | |
-- j_stackdump() -- dumps the stack | |
-- | |
-- * convention: | |
-- send_* - needs the client_idx as first argument (NOTE not id!) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Unzip($zipfile, $outdir) | |
{ | |
Add-Type -AssemblyName System.IO.Compression.FileSystem | |
$archive = [System.IO.Compression.ZipFile]::OpenRead($zipfile) | |
foreach ($entry in $archive.Entries) | |
{ | |
$entryTargetFilePath = [System.IO.Path]::Combine($outdir, $entry.FullName) | |
$entryDir = [System.IO.Path]::GetDirectoryName($entryTargetFilePath) | |
#Ensure the directory of the archive entry exists |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
namespace System.Numerics | |
{ | |
public struct BigDecimal : IConvertible, IFormattable, IComparable, IComparable<BigDecimal>, IEquatable<BigDecimal> | |
{ | |
public static readonly BigDecimal MinusOne = new BigDecimal(BigInteger.MinusOne, 0); | |
public static readonly BigDecimal Zero = new BigDecimal(BigInteger.Zero, 0); | |
public static readonly BigDecimal One = new BigDecimal(BigInteger.One, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adapted to BR phone format from the class | |
* UsPhoneNumberFormatter by Samik Bandyopadhyay: | |
* http://stackoverflow.com/a/23659268/332839 | |
*/ | |
public class BrPhoneNumberFormatter implements TextWatcher { | |
final int MAX_LENGTH = 11; | |
//This TextWatcher sub-class formats entered numbers as (41) 1234(5)?-6789 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Converts files to the given encoding. | |
Matches the include pattern recursively under the given path. | |
.EXAMPLE | |
Convert-FileEncoding -Include *.js -Path scripts -Encoding UTF8 | |
#> | |
function Convert-FileEncoding([string]$Include, [string]$Path, [string]$Encoding='UTF8') { | |
$count = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# I wrote this script to change the encoding of a large | |
# source code repository with inconsistent file encoding | |
SOURCE_DIR=$1 | |
FILE_MASK="*.$2" | |
DESTINATION_ROOT=$3 | |
if [ $# -ne 3 ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
file=$1 | |
test -z $file && echo "file required." 1>&2 && exit 1 | |
git filter-branch -f --index-filter "git rm -r --cached $file --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all | |
git ignore $file | |
git add .gitignore | |
git commit -m "Add $file to .gitignore" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Creates pretty-looking commit messages for git. This was created to pretty | |
print the old-commit-id values for filter-branched-rewritten commits in | |
pyphantomjs from the phantomjs repository. | |
""" | |
import os | |
import sys |