Skip to content

Instantly share code, notes, and snippets.

View tobychung's full-sized avatar
💭
🐕

Toby tobychung

💭
🐕
View GitHub Profile
@tobychung
tobychung / difference.js
Last active October 29, 2015 02:25
比較obj差異
function findDifferences(objectA, objectB) {
var propertyChanges = [];
var objectGraphPath = ["this"];
(function(a, b) {
if(a.constructor == Array) {
// BIG assumptions here: That both arrays are same length, that
// the members of those arrays are _essentially_ the same, and
// that those array members are in the same order...
for(var i = 0; i < a.length; i++) {
objectGraphPath.push("[" + i.toString() + "]");
# Source: https://github.com/Casecommons/casecommons_workstation/blob/master/templates/default/dot_tmux.conf.erb
# https://github.com/Casecommons/vim-config/blob/master/init/tmux.vim
set-option -g terminal-overrides 'xterm:colors=256,*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cs=\E]12;%p1%s\007:Cr=\E]112\007:Ss=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007'
unbind S
unbind R
unbind %
bind | split-window -h
bind – split-window -v
//--------- 只設定一個css ---------//
$( "body" ).on( "click",function() {
$( this ).css("width", "100px" );
});
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
char a;
a = 'A';
{
"size": 29,
"items": [
{
"utc_offset": 8,
"duration": 24020.999,
"start_time": "Thu, 14 Sep 2017 08:56:30",
"total_calories": 1720,
"tracking_mode": "outdoor",
"total_distance": 36426.1911144587,
{
"size": 38,
"items": [
{
"utc_offset": 8,
"duration": 15743,
"start_time": "Sun, 17 Sep 2017 11:47:15",
"total_calories": 1570,
"tracking_mode": "outdoor",
"total_distance": 26252.8155614763,
import { RSAA } from 'redux-api-middleware';
import _ from 'lodash';
import * as types from './actionTypes';
export const getProductsWithCondition = (cateNum, colKey, colValue) => async (dispatch) => {
const response = await dispatch({
[RSAA]: {
endpoint: '/getProductsWithCondition',
method: 'POST',
body: JSON.stringify({ cateNum, colKey, colValue }),
var assert = require('assert');
describe('webdriver.io page', function() {
it('should have the right title', function () {
browser.url('http://webdriver.io');
var title = browser.getTitle();
assert.equal(title, 'WebdriverIO - Selenium 2.0 javascript bindings for nodejs');
});
});
// 寫法解釋 -----------------------------------------
@tobychung
tobychung / config.js
Created July 19, 2019 04:11
Config file for storybook
import { configure } from '@storybook/html';
import '../src/scss/main.scss';
function loadStories() {
const myDOM = document.createElement('div');
myDOM.className = 'bg';
myDOM.style.cssText = 'margin-top: 200px; display: flex; justify-content: center; align-items: center;';
require(`../stories/a.js`);
<?php
public function match( $match, $operator, $value ) {
$value = $this->get_value( $value );
if ( '==' == $operator ) :
// Promotion: If cart match the category and greater than two then shipping free
$count = 0;
foreach ( WC()->cart->get_cart() as $product ) :