Skip to content

Instantly share code, notes, and snippets.

Avatar
😀

David Ng david90

😀
View GitHub Profile
View CopyPublicKey
pbcopy < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
View sshTunnel
ssh -D 8080 -C -N username@example.com
@david90
david90 / compareVersion.mm
Created Jul 8, 2014
Compare Version String in iOS
View compareVersion.mm
- (BOOL) isVersion:(NSString *)thisVersionString higherThan:(NSString *)thatVersionString {
// LOWER
if ([thisVersionString compare:thatVersionString options:NSNumericSearch] == NSOrderedAscending) {
NSLog(@"%@ < %@", thisVersionString, thatVersionString);
return NO;
}
// EQUAL
if ([thisVersionString compare:thatVersionString options:NSNumericSearch] == NSOrderedSame) {
View meta-tags.md

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@david90
david90 / gist:92e87125154dd268351b
Created Jul 7, 2015
Regex to block spam referral in google analytics
View gist:92e87125154dd268351b
(semalt\.semalt\.com|buttons-for-website\.com|best-seo-offer\.com|buttons-for-your-website\.com|100dollars-seo\.com|www\.event-tracking\.com|floating-share-buttons\.com|free-social-buttons\.com|www\.Get-Free-Traffic-Now\.com)
@david90
david90 / skip_extension
Created Jul 8, 2015
Check not in extension
View skip_extension
#if !(defined(__has_feature) && __has_feature(attribute_availability_app_extension))
// some [UIApplication sharedApplication] code
#endif
@david90
david90 / app_metrics.js
Created Aug 6, 2015
Simple Event tracking Server that insert records to MySQL (express, mysql module needed)
View app_metrics.js
/* Server monitor */
// require('newrelic');
var mysql = require('mysql');
var express = require('express');
var app = express();
var eventsCollection;
var sessionsCollection;
/** MySQL Settings **/
@david90
david90 / skygear-cms-readme.md
Last active Jan 18, 2017
Skygear CMS - README
View skygear-cms-readme.md

CMS Plugin for Skygear

This is a Skygear Plugin to provide CMS functionality to your app.

Installation

It is easy to use CMS in your Skygear app on the cloud. To do that, add the following line in your index.js in the root of your repo:

@david90
david90 / extracting_inception.py
Created Feb 14, 2017
Code for extracting inception bottleneck feature
View extracting_inception.py
import os
import tensorflow as tf
import tensorflow.python.platform
from tensorflow.python.platform import gfile
import numpy as np
def create_graph(model_path):
"""
create_graph loads the inception model to memory, should be called before
calling extract_features.
@david90
david90 / train_svm.py
Created Feb 14, 2017
Code for the training the SVM classifier
View train_svm.py
import os
import sklearn
from sklearn import cross_validation, grid_search
from sklearn.metrics import confusion_matrix, classification_report
from sklearn.svm import SVC
from sklearn.externals import joblib
def train_svm_classifer(features, labels, model_output_path):
"""