View 0_reuse_code.js
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View RRDrawable.java
This file contains 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
public class RRDrawable extends Drawable { | |
private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); | |
public RRDrawable(int color) { | |
paint.setColor(color); | |
paint.setStyle(Paint.Style.FILL); | |
} | |
@Override | |
public void draw(Canvas canvas) { |
View MyCellSubclass.swift
This file contains 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
class MyCellSubclass: UITableViewCell { | |
@IBOutlet var myNameLabel: UILabel!; | |
@IBOutlet var myOtherLabel: UILabel!; | |
// Do not include any inits, or we need to implement | |
// the required init outself | |
// http://stackoverflow.com/questions/25126295/swift-class-does-not-implement-its-superclasss-required-members | |
} |
View [swift]enum-range-printable.swift
This file contains 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
// Playground - noun: a place where people can play | |
import UIKit | |
enum State : String { | |
case ASLEEP = "asleep", | |
AWAKE = "awake", | |
DRUNK = "drunk" | |
} |
View build.txt
This file contains 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
android { | |
compileSdkVersion ... | |
..... | |
// Note this section MUST appear before 'buildTypes' in the build.gradle file. | |
signingConfigs { | |
release { | |
storeFile file("filename.keystore") | |
storePassword "password" |
View command.sh
This file contains 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/sh | |
if [ $# -ne 2 ]; then | |
echo "Usage: $0 (first parameter) (second parameter) e.g. $0 foo bar"; | |
exit 1; | |
fi | |
foo=$1 | |
bar=$2 |
View UIImage+AddtionalFunctionalities.h
This file contains 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
#import <UIKit/UIKit.h> | |
@interface UIImage (AddtionalFunctionalities) | |
//TintColor... | |
- (UIImage *)imageWithTint:(UIColor *)tintColor; | |
//scale and resize... | |
-(UIImage*)scaleToSize:(CGSize)size; | |
@end |
View git-code-file-changes.sh
This file contains 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
git log --numstat --author="Ben Clayton" --since "1 month" -- *.m *.h | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}' |
View CustomLogFormatter.h
This file contains 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
// | |
// Created by Ben Clayton on 23/12/14. | |
// Copyright (c) 2014 Calvium Ltd. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <UIKit/UIKit.h> | |
#import "DDLog.h" | |
@interface CustomLogFormatter : NSObject<DDLogFormatter> |
View NSPointerArray+CALCompact.h
This file contains 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
#import <Foundation/Foundation.h> | |
@interface NSPointerArray (CALCompact) | |
- (void)cal_compact; | |
@end |
OlderNewer