Skip to content

Instantly share code, notes, and snippets.

View david90's full-sized avatar
😛

David Ng david90

😛
View GitHub Profile
@david90
david90 / train_svm.py
Created February 14, 2017 09:08
Code for the training the SVM classifier
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):
"""
@david90
david90 / svm_training_result
Created February 14, 2017 09:11
SVM training result
Best parameters set:
{'kernel': 'linear', 'C': 1}
Confusion matrix:
Labels: 8531,8539,8567,8568,8599,8715,8760,8773,8777,8778,8808,8816
[[ 4 0 0 0 0 0 0 0 0 0 0 0]
[ 0 2 0 0 0 0 0 0 0 0 0 0]
[ 0 0 12 0 0 0 0 0 0 0 0 0]
[ 0 0 0 9 0 0 0 0 0 0 0 0]
@david90
david90 / main.go
Created April 19, 2017 03:57
Webhook on Kubernetes
package main
import (
"context"
"encoding/json"
"log"
"net/http"
"github.com/google/go-github/github"
"golang.org/x/oauth2"
authentication "k8s.io/client-go/pkg/apis/authentication/v1beta1"
)
@david90
david90 / sampleRoute.js
Created June 30, 2017 10:17
Sample Route
const sampleRoute = {
renderNavBarLeft: () => (<NavBarBackButton />),
renderNavBarTitle: () => (<SimplePageTitle />),
renderNavBarRight: () => null,
renderScene: () => (<SamplePage />),
};
// navigator
<Navigator
{ ...otherPropsPassingToNavigator }
@david90
david90 / setParams.js
Created June 30, 2017 10:19
Update the title by setParams
class UserPage extends React.Component {
static navigationOptions: {
header: ({state}) => ({
left: (<NavBarBackButton />),
title: (
<UserPageTitle
userName={state.params.userName}
profilePicUrl={state.params.profilePicUrl}
/>
@david90
david90 / skygear_stripe.md
Last active March 14, 2018 11:20 — forked from arsewizz/gist:c59ca68267df4b103e56082f06f9a288
Ionic payment with Stripe, then create a record at Skygear.

On Ionic side

1. Create a ionic project

  • ionic start ionicStripe blank

2. Install the stripe plugin

  • ionic cordova plugin add cordova-plugin-stripe
  • npm install --save @ionic-native/stripe

3. add stripe to module.ts

 * import { Stripe } from '@ionic-native/stripe';

4. On the payment page :