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
// getComponent is a function that returns a promise for a component | |
// It will not be called until the first mount | |
function asyncComponent(getComponent) { | |
return class AsyncComponent extends React.Component { | |
static Component = null; | |
state = { Component: AsyncComponent.Component }; | |
componentWillMount() { | |
if (!this.state.Component) { | |
getComponent().then(Component => { |
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
/* | |
******************************************************************************** | |
Golang - Asterisk and Ampersand Cheatsheet | |
******************************************************************************** | |
Also available at: https://play.golang.org/p/lNpnS9j1ma | |
Allowed: | |
-------- | |
p := Person{"Steve", 28} stores the value |
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 libxmljs = require("libxmljs"); | |
var xml = [ | |
'<?xml version="1.0" encoding="utf-8"?>', | |
'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">', | |
' <soap:Body>', | |
' <Response xmlns="http://tempuri.org/">', | |
' <Result>', | |
' <client xmlns="">', | |
' <msg>SEARCH OK.</msg>', | |
' <code>0</code>', |
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
// | |
// ViewController.swift | |
// SwiftJSONParsingDemo | |
// | |
// Created by Ashish Kakkad on 12/10/16. | |
// Copyright © 2016 Kode. All rights reserved. | |
// | |
import UIKit |
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
#!/bin/bash | |
/usr/local/bin/archey -c | |
export GOPATH=$HOME/code/go | |
export GOBIN=$HOME/code/go/bin | |
export RDOCOPT="--encoding=UTF-8" | |
export PIP_RESPECT_VIRTUALENV=true | |
export WORKON_HOME=$HOME/.venv | |
export EDITOR='subl --wait' | |
export LC_CTYPE="utf-8" | |
export PATH="$PATH:./node_modules/.bin:/usr/local/sbin:$GOPATH/bin" |
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 | |
$template = "I am {{name}}, and I work for {{company}}. I am {{age}}."; | |
# Your template tags + replacements | |
$replacements = array( | |
'name' => 'Jeffrey', | |
'company' => 'Envato', | |
'age' => 27 | |
); |