Skip to content

Instantly share code, notes, and snippets.

View khlbrg's full-sized avatar
💭
Working

Andreas Kihlberg khlbrg

💭
Working
View GitHub Profile
@acdlite
acdlite / app.js
Last active January 20, 2023 08:23
Quick and dirty code splitting with React Router v4
// 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 => {
@josephspurrier
josephspurrier / values_pointers.go
Last active April 28, 2024 16:41
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
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>',
@ashishkakkad8
ashishkakkad8 / JOSNArraySwiftParsingiOS
Last active December 31, 2017 05:59
JSON Array Parsing in Swift Langauage - Swift 3 – iOS 10 – Xcode 8 GM
//
// ViewController.swift
// SwiftJSONParsingDemo
//
// Created by Ashish Kakkad on 12/10/16.
// Copyright © 2016 Kode. All rights reserved.
//
import UIKit
@maumercado
maumercado / profile.bash
Last active October 10, 2015 03:57
bash git prompt and others
#!/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"
@JeffreyWay
JeffreyWay / template.php
Created June 8, 2012 14:59
Template Example
<?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
);