Think different(ly)
Get out of your rut and learn new ways to think.
require 'cgi' | |
require 'digest/md5' | |
require 'net/https' | |
require 'uri' | |
module Jekyll | |
class GistTag < Liquid::Tag | |
def initialize(tag_name, text, token) | |
super | |
@text = text |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.text.ParseException; | |
import javax.servlet.http.HttpServlet; | |
import javax.servlet.http.HttpServletRequest; | |
import com.google.gwt.user.server.rpc.RemoteServiceServlet; | |
import com.google.gwt.user.server.rpc.SerializationPolicy; | |
import com.google.gwt.user.server.rpc.SerializationPolicyLoader; |
/** @jsx React.DOM */ | |
var BootstrapModalMixin = function() { | |
var handlerProps = | |
['handleShow', 'handleShown', 'handleHide', 'handleHidden'] | |
var bsModalEvents = { | |
handleShow: 'show.bs.modal' | |
, handleShown: 'shown.bs.modal' | |
, handleHide: 'hide.bs.modal' |
atom.commands.add('atom-text-editor', 'me:fold-to-it', event => { | |
const editor = event.target.closest('atom-text-editor').getModel() | |
const languageMode = editor.getBuffer().getLanguageMode() | |
if (!languageMode.tree) return | |
editor.unfoldAll() | |
const startsWith = (node, text) => { | |
const startPosition = new Point(node.startPosition.row, node.startPosition.column) | |
const endPosition = startPosition.traverse([0, text.length]) |
var webpack = require("webpack"); | |
var ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
var lessLoader = ExtractTextPlugin.extract( | |
"css?sourceMap!less?sourceMap" | |
); | |
module.exports = { | |
cache: true, | |
entry: { bundle: "./master/client/index.jsx" }, |
var context = new webkitAudioContext(); | |
var offline = new webkitOfflineAudioContext(2, 10 * 44100, 44100); | |
var blob; | |
var bufferLoader; | |
bufferLoader = new BufferLoader( | |
context, [ | |
'/sound/sound1.mp3', | |
], | |
finishedLoading |
module Jekyll | |
class MathJaxBlockTag < Liquid::Tag | |
def render(context) | |
'<script type="math/tex; mode=display">' | |
end | |
end | |
class MathJaxInlineTag < Liquid::Tag | |
def render(context) | |
'<script type="math/tex">' | |
end |
React introduced shallow rendering in 0.13. This is an excellent feature that I wish was included earlier in React. It aims to solve the problem of unit testing components without going through a real, or jsdom mocked, DOM. I couldn't find any info online about what lifecycle events it actually fires. So I did some testing of my own. To reproduce, put component.js
and test.js
into a folder and run node test.js
.
TLDR; shallow rendering only invokes the following lifecycle hooks (in order):
getDefaultProps
getInitialState
componentWillMount
stops here until re-rendercomponentWillReceiveProps
shouldComponentUpdate
componentWillUpdate
const React = require('react'); | |
const mapValues = require('lodash/object/mapValues'); | |
const createGetState = require('app/redux_shims/create_get_state'); | |
const Fluxxor = require('fluxxor'); | |
const FluxMixin = Fluxxor.FluxMixin(React); | |
const StoreWatchMixin = Fluxxor.StoreWatchMixin; | |
const createDispatcher = require('app/redux_shims/create_dispatcher'); | |
const Router = require('react-router'); | |
function bindActionCreator(flux, router, action) { |