Skip to content

Instantly share code, notes, and snippets.

View wyqydsyq's full-sized avatar
🌏
Breaking the Internet

wyqydsyq wyqydsyq

🌏
Breaking the Internet
  • Brisbane, Australia
View GitHub Profile
@wyqydsyq
wyqydsyq / gist:9044751
Created February 17, 2014 04:30
Shopify call
shopify = {
// call defaults
'site': false,
'token': false,
'data': {},
// make an API call, when done, calls callback(data)
'call': function(hit, callback, data, site, token){
if(typeof data === 'undefined') data = this.data;
@wyqydsyq
wyqydsyq / gist:80c40dfce3f1d8621535
Created January 6, 2015 01:36
Xero GST rounding error sample data
{
Invoice: {
Type: "ACCREC",
Contact: [{
ContactStatus: "ACTIVE",
Name: "Damon Poole",
FirstName: "Damon",
LastName: "Poole",
EmailAddress: "damon@mywork.com.au",
Phones: {
@wyqydsyq
wyqydsyq / .htaccess
Created June 24, 2015 04:04
Compression & Expires
## Compression ##
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
SELECT SUM(`earnings`) AS `total` FROM `rooms` WHERE `room_type` = 'single' AND `roomPrice` NOT NULL
@wyqydsyq
wyqydsyq / example.js
Created July 5, 2016 04:26
css modules classname
import styles from './styles.less';
const render = (state) => h('form', {props: {className: [styles.form, styles.formHorizontal].join(' ')}}, [
h('fieldset', [
// show alerts if there's any
state.alerts.length ? h('div.alerts',
state.alerts.map(alert => h(`div.alert.${alert.className}`, alert.text))
) : '',
h(`legend.${styles.legend}`, 'Login'),
h(`div.${styles.field}`, [
h(`label`, 'Email'),
@wyqydsyq
wyqydsyq / app.js
Last active July 5, 2016 05:37
undefined vtree
import {h} from '@cycle/dom';
import xs from 'xstream';
import Login from 'login';
let app = function(sources) {
return {
DOM: Login(sources).DOM
};
}
@wyqydsyq
wyqydsyq / test1.js
Last active July 5, 2016 23:59
Cycle wrapping
import {h} from '@cycle/dom';
import xs from 'xstream';
import Test2 from './test2';
import Test3 from './test3';
let Test1 = function(sources) {
return {
DOM: Test2(sources).DOM
// DOM: Test3().DOM
@wyqydsyq
wyqydsyq / .babelrc
Created July 19, 2016 04:23
Webpack + Hapi issue
{
"presets": ["es2015","es2016"],
"only": ["**/src/ui/**.js", "**/src/server.js"],
"ignore": "**/node_modules/**.js",
"sourceMaps": "inline",
"plugins": [
["cycle-hmr/xstream", {
"include": "**/src/ui/**.js",
"testExportName": "^[A-Z]|default"
}]
@wyqydsyq
wyqydsyq / login-form.js
Created July 19, 2016 05:32
Login Form
import {div, form, fieldset, legend, label, input, button, i, strong} from '@cycle/dom';
import {makeHTTPDriver} from '@cycle/http';
import isolate from '@cycle/isolate';
import xs from 'xstream';
import classes from 'dependencies/classes';
import styles from '../form/styles.less';
import LabelInput from 'components/label-input';
@wyqydsyq
wyqydsyq / webpack.config.js
Created July 21, 2016 04:45
Loaders being bundled
var webpack = require('webpack'),
path = require('path'),
CopyWebpackPlugin = require('copy-webpack-plugin'),
webpackEnv = require('webpack-env'),
fs = require('fs');
nodeExternals = require('webpack-node-externals'),
externals = nodeExternals();
var config = {
context: path.resolve(__dirname),