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 / render.js
Last active July 26, 2016 01:29
Translate
// assuming your render component recieves a stream called selectedTargets$ that emits an object of the source/target languages you're translating
const vtree$ = sources.translate$.debug().map(translation =>
div('#registrationScreeenPage.panel.contentTop.active', [
div(translation('foo'))
]);
);
@wyqydsyq
wyqydsyq / createuser.js
Created July 25, 2016 03:45
HTTPDriver child component issues
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 / create-user.js
Last active July 22, 2016 07:01
Isomorphism
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),
@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 / .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 / 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 / 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 / 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'),
SELECT SUM(`earnings`) AS `total` FROM `rooms` WHERE `room_type` = 'single' AND `roomPrice` NOT NULL