Skip to content

Instantly share code, notes, and snippets.

@gotev
gotev / preBuildGradleTask.groovy
Created December 21, 2016 18:24
Pre build gradle task
// add this after dependencies section in a module
// this script has to be in the same path as the module
// otherwise, relative or absolute paths has to be used
task someScript(type: Exec) {
commandLine 'sh', '-c', './some_script.sh'
}
preBuild.dependsOn someScript
@ozzieperez
ozzieperez / iosStringSize.cs
Created June 26, 2015 20:48
Xamarin IOS - Get the size of a string
//Method 1: No restrictions
((NSString)t.Text).GetSizeUsingAttributes(new UIStringAttributes {Font = t.Font});
//Method 2: Has to fit within a width
label.Frame = new CGRect(CGPoint.Empty, ((NSString)label.Text).GetBoundingRect(
new CGSize(width, nfloat.MaxValue),
NSStringDrawingOptions.UsesLineFragmentOrigin,
new UIStringAttributes { Font = label.Font},
null
).Size);
@xleon
xleon / ExtendedSearchBarRenderer.cs
Created February 25, 2015 01:44
Xamarin.Forms renderer to hide the "Cancel" button of a SearchBar on iOS
using System;
using Xamarin.Forms.Platform.iOS;
using Xamarin.Forms;
using UIKit;
using System.Diagnostics;
[assembly: ExportRenderer(typeof(SearchBar), typeof(Namespace.iOS.Renderers.ExtendedSearchBarRenderer))]
namespace Namespace.iOS.Renderers
{
@JakeWharton
JakeWharton / dex.sh
Last active March 25, 2024 13:54
`classes.dex` method count helpers. Requires smali/baksmali from https://code.google.com/p/smali/ and dexdump from the build-tools in the Android SDK be on your PATH.
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
baksmali $1 -o $dir
for pkg in `find $dir/* -type d`; do
smali $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')
anonymous
anonymous / gist:4104258
Created November 18, 2012 08:29
# ビッグエンディアン,bomなしutf-8
11100011100000101011001111100011100000111001111111100011100000111010010111100011100000111000101111100011100000101011000111100011100000111011110011100011100000101011011111100011100000111010011111100011100000111011001111100101100010101001101111100100101110001000110111101000101101101011001111100011100000011010011111100011100000011000001011100011100000101000111111100011100000101000010011100101101001001010011111100110100000111010100011100100101110101000101111101111101111001000110011100011100000101011011111100011100000111011001111100011100000101011100011100011100000011001010111100011100000101001001111100011100000011000110011100011100000101011011111100011100000111011001111100011100000101011100011100011100000011000111111100011100000101001001111100011100000011010101111101001100110011000110111100110101000001011110011101111101111001000110011100101101111001000111111100110101100111010001011100011100000011001010111100011100000101001001100101000001100100011100000101001
@unbracketed
unbracketed / export_repo_issues_to_csv.py
Last active August 3, 2023 18:13
Export Issues from Github repo to CSV (API v3)
"""
Exports Issues from a specified repository to a CSV file
Uses basic authentication (Github username + password) to retrieve Issues
from a repository that username has access to. Supports Github API v3.
"""
import csv
import requests