This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test(params) { | |
return { | |
type: 'TEST', | |
payload: params | |
} | |
} | |
const metaizeThis = (fn) => { | |
fn.addMeta = function(meta) { | |
if(!this._originalFunction) this._originalFunction = this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({ | |
template: './src/index.html', | |
filename: 'index.html', | |
inject: 'body' | |
}) | |
module.exports = { | |
entry: './src/index.js', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { render } from 'react-dom' | |
import { hashHistory, Router, Route, Link, withRouter} from 'react-router' | |
const App = React.createClass({ | |
render() { | |
return ( | |
<div> | |
<ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { render } from 'react-dom' | |
import { browserHistory, Router, Route, Link, withRouter} from 'react-router' | |
import withExampleBasename from '../withExampleBasename' | |
const App = React.createClass({ | |
render() { | |
return ( | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Podium = {}; | |
Podium.keydown = function(k) { | |
var oEvent = document.createEvent('KeyboardEvent'); | |
// Chromium Hack | |
Object.defineProperty(oEvent, 'keyCode', { | |
get : function() { | |
return this.keyCodeVal; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parent extends React.Component { | |
constructor(...args) { | |
super(args); | |
this.state = { | |
renderChild: true | |
} | |
this.interval = null; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var React = require("react"); | |
var Recipe = React.createClass({ | |
updateList: function() { | |
var list = []; | |
for (let i = 0; i < window.localStorage.length - 1; i++) { | |
var key = window.localStorage.key(i); | |
list.push(window.localStorage.getItem(key)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reduce(state = Immutable.fromJS({ | |
items: { | |
values: [] | |
} | |
}), action = null) { | |
if(action) { | |
switch(action.type) { | |
case "ADD": | |
return state.updateIn(['items','values'], (data) => data.push(action.payload)); | |
case "REMOVE": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const EMIT_NOTIFICATION = 'EMIT_NOTIFICATION' | |
const HIDE_NOTIFICATION = 'HIDE_NOTIFICATION' | |
const initialState = { | |
maxItems: 4, | |
dismissTimeout: 10000, // 10 seconds | |
items: [], | |
queue: [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function preventUnnamedPosts($postId) { | |
$post = get_post($postId); | |
if(empty($post->post_title)) { | |
wp_update_post(array( | |
'ID' => $postId, | |
'post_title' => $postId | |
)); | |
} | |
} |