Skip to content

Instantly share code, notes, and snippets.

Tony Hung tbass134

  • New York
Block or report user

Report or block tbass134

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View classifier_from_little_data_script_2.py
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
View WatchConnectivitySingletonDemo.swift
//
// WatchSessionManager.swift
// WatchConnectivityDemo
//
// Created by Natasha Murashev on 9/3/15.
// Copyright © 2015 NatashaTheRobot. All rights reserved.
//
import WatchConnectivity
@gillesdemey
gillesdemey / querystring.swift
Last active Jul 8, 2019
Retrieve specific query string parameter from NSURL
View querystring.swift
func getQueryStringParameter(url: String, param: String) -> String? {
let url = NSURLComponents(string: url)!
return
(url.queryItems? as [NSURLQueryItem])
.filter({ (item) in item.name == param }).first?
.value()
}
View useful_pandas_snippets.md

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

View ArrayHelpers.swift
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {
@santhoshtr
santhoshtr / Logger.js
Last active Oct 17, 2018
Winston based configurable node logger
View Logger.js
var winston = require( 'winston' ),
fs = require( 'fs' ),
logDir = 'log', // Or read from a configuration
env = process.env.NODE_ENV || 'development',
logger;
winston.setLevels( winston.config.npm.levels );
winston.addColors( winston.config.npm.colors );
if ( !fs.existsSync( logDir ) ) {
@stephenhardy
stephenhardy / git-clearHistory
Created Apr 26, 2013
Steps to clear out the history of a git/github repository
View git-clearHistory
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@mattt
mattt / uiappearance-selector.md
Last active Aug 14, 2019
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3
View uiappearance-selector.md

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
  sed 's/UI_APPEARANCE_SELECTOR//g'   | \
@aseemk
aseemk / README.md
Last active Feb 14, 2018
A bookmarklet for "selecting all" (technically, "toggling all") checkboxes on the Amazon AWS S3 console.
View README.md
@mayoff
mayoff / Arrow.swift
Last active Jul 22, 2019
UIBezierPath category to create an arrow (now with a Swift version!)
View Arrow.swift
// Swift 2.2 syntax / API
import UIKit
extension UIBezierPath {
class func arrow(from start: CGPoint, to end: CGPoint, tailWidth: CGFloat, headWidth: CGFloat, headLength: CGFloat) -> Self {
let length = hypot(end.x - start.x, end.y - start.y)
let tailLength = length - headLength
You can’t perform that action at this time.