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 August 20, 2024 20:28
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 November 10, 2024 13:48
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
@vinhnx
vinhnx / remove-bottom-line-navbar.md
Last active October 31, 2024 06:34
remove 1px bottom line of the navigation bar

If you just want to use a solid navigation bar color and have set this up in your storyboard, use this code in your AppDelegate class to remove the 1 pixel border via the appearance proxy:

Objective-C

[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init]
                                  forBarPosition:UIBarPositionAny
                                      barMetrics:UIBarMetricsDefault];

[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
@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