Skip to content

Instantly share code, notes, and snippets.

翁治平 gocreating

  • Taiwan
View GitHub Profile
View tile
import React, { Component } from 'react'
class Tile extends Component {
render() {
const { type, colors } = this.props
switch (type) {
case '1':
return (
<div style={{
width: 0,
@gocreating
gocreating / my-model.js
Created Sep 20, 2018 — forked from pulkitsinghal/my-model.js
Non-Static (instance) remote methods for loopback
View my-model.js
var loopback = require('loopback');
// HINT(s):
// Getting the app object: http://docs.strongloop.com/display/public/LB/Working+with+LoopBack+objects
// From a model script: http://docs.strongloop.com/display/public/LB/Working+with+LoopBack+objects#WorkingwithLoopBackobjects-Fromamodelscript
module.exports = function(StoreModel) {
StoreModel.prototype.instanceRemoteMethodSignature = function(cb) {
console.log('print this instance object: ', this);
cb(null);
};
View phm-plot.py
# coding=UTF-8
# Usage:
# python plot.py [end_record]
# python plot.py [start_record] [end_record]
import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
@gocreating
gocreating / gist:b391b81e65698b7223ce78a1cb9f3cd1
Created Oct 23, 2016 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
View gist:b391b81e65698b7223ce78a1cb9f3cd1
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
View plot.py
# coding=UTF-8
import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
mpl.rcParams['agg.path.chunksize'] = 10000
FILES = [
'./Channel4_20161004083134734.csv',
View data-mining-hw1-pm2_5-preprocessor.py
import _mysql
import time
FILE_NAMES = [
'C:\Users\go-creating\Desktop\data-mining-hw1\dataset\data.log-20160918',
'C:\Users\go-creating\Desktop\data-mining-hw1\dataset\data.log-20160919',
'C:\Users\go-creating\Desktop\data-mining-hw1\dataset\data.log-20160920',
'C:\Users\go-creating\Desktop\data-mining-hw1\dataset\data.log-20160921',
'C:\Users\go-creating\Desktop\data-mining-hw1\dataset\data.log-20160922',
'C:\Users\go-creating\Desktop\data-mining-hw1\dataset\data.log-20160923',
View example.js
// Usage
var _r = new DollarRecognizer();
if (_points.length >= 10) {
var isUseProtractor = false;
var result = _r.Recognize(_points, isUseProtractor);
console.log("Result: " + result.Name + " (" + round(result.Score,2) + ").");
} else {
console.log("Too few points made. Please try again.");
}
View boot.js
import React from 'react';
import Router from 'react-router';
import routes from '../routes';
Router.run(routes, Router.HistoryLocation, (Handler) => {
React.render(<Handler />, document.getElementById('react-container'));
});
View forms.py
class SubnetForm(forms.Form):
# ...略
@staticmethod
def int_to_human(address):
# ...略
return ".".join(str(int(part.ljust(8, "0"), 2)) for part in parts)
def get_network_information(self):
return ({
"address": self.int_to_human(address),
View .js
// flux.js
var Alt = require('alt');
export default class Flux extends Alt {
constructor() {
super();
this.addActions('ActionCreators', require('./actions/TodoActions'));
this.addStore('TodoStore', require('./stores/TodoStore'));
You can’t perform that action at this time.