Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / gist:1190397
Created September 3, 2011 01:57
private TextView htmlTextView;
private SpannableStringBuilder htmlSpannable;
@Override
public void onCreate(Bundle savedInstanceState) {
// ...
// first parse the html
// replace getHtmlCode() with whatever generates/fetches your html
@leighmcculloch
leighmcculloch / NSString_stripHtml.h
Last active February 21, 2018 22:45
NSString + Strip HTML
// NSString_stripHtml.h
// Copyright 2011 Leigh McCulloch. Released under the MIT license.
#import <Foundation/Foundation.h>
@interface NSString (stripHtml)
- (NSString*)stripHtml;
@end
@bartoszmajsak
bartoszmajsak / prepare-commit-msg.sh
Last active March 20, 2024 08:12
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
@leobalter
leobalter / gist:2787933
Created May 25, 2012 12:54
List of languages that compile to JS
# [[Original Link|https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS]]
#### CoffeeScript Family (& Friends)
* [[CoffeeScript|http://jashkenas.github.com/coffee-script/]] Unfancy JavaScript
###### Family (share genes with CoffeeScript)
* [[Coco|https://github.com/satyr/coco]] A CoffeeScript dialect that aims to be more radical and practical, also acts as a test bed for features that get imported in CoffeeScript.
* [[LiveScript|http://gkz.github.com/LiveScript/]] is a fork of Coco that is much more compatible with CoffeeScript, more functional, and with more features.
@hofmannsven
hofmannsven / README.md
Last active July 3, 2024 09:53
Git CLI Cheatsheet
@dlo
dlo / Auto-layout-keyboard-adjustment.md
Last active February 26, 2021 07:33
How to adjust a view's height with Auto Layout when a keyboard appears or disappears in iOS 7.

This gist outlines how to resize a view when a keyboard appears using Auto Layout (there are a bunch of code samples out there that manually adjust the view's frame, but that's just so 2013). The method I outline below works universally on both iPhone and iPad, portrait and landscape, and is pretty darn simple.

Setting Up

The first thing to do is to define our containing view controller, the view, and the bottom constraint that we'll use to adjust its size.

Here's HeightAdjustingViewController.h. We don't need to expose any public properties, so it's pretty bare.

@berzniz
berzniz / NSObject+Debounce.h
Created January 25, 2014 16:18
Debounce method for Objective C
@interface NSObject (Debounce)
- (void)debounce:(SEL)action delay:(NSTimeInterval)delay;
@end
@azimut
azimut / README.md
Last active October 30, 2020 22:18
Create an animated heat map .gif from your lastfm scrobbler history

Lastfm Heat Map gif

Imgur

Description

Use as input file the output of lastfm-export.py. If you don't want to download one you could use mine here.

heatmaps.py generate the heat maps images on the current directory.

@walm
walm / gist:352b49e708119bc8bbf4
Created October 20, 2014 06:39
Safari backspace as back

Enable

defaults write com.apple.Safari NSUserKeyEquivalents -dict-add Back "\U232b"

Disable

defaults delete com.apple.Safari NSUserKeyEquivalents

@jgarber623
jgarber623 / delicious.html
Created December 2, 2014 06:07
A sample of the Netscape Bookmark File Format as exported from Delicious.
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<!-- This is an automatically generated file.
It will be read and overwritten.
Do Not Edit! -->
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><A HREF="https://developer.apple.com/library/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/index.html#//apple_ref/doc/-%20uid/TP40014508" ADD_DATE="1414706885" PRIVATE="0" TAGS="javascript,mac,osx,yosemite">JavaScript for Automation Release Notes</A>
<DD>This article describes JavaScript for Automation, a new feature in OS X Yosemite.