Skip to content

Instantly share code, notes, and snippets.

# Put me in ~/.atom/snippets.cson
'.source.js':
'import connect':
'prefix': 'cn'
'body': "import {connect} from 'react-redux';"
'export connect':
'prefix': 'ecn'
'body': "export default connect(mapStateToProps)(${1:MyComponent});"
'import React + Component':
@renshuki
renshuki / ubuntu_agnoster_install.md
Last active December 30, 2024 16:16
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@jackfranklin
jackfranklin / omg.js
Created October 21, 2015 13:38
Deep destructuring and renaming in ES6
function foo({ text, user: { screen_name: screenName }}) {
console.log('text', text);
console.log('name', screenName);
}
foo({
text: 'hello world',
user: { screen_name: 'Jack' },
});
@ebidel
ebidel / polymer-perf-bookmarklet.js
Last active May 1, 2021 15:42
Polymer performance numbers bookmarklet
javascript:(function(){(function printStats(){var loadTimes=window.chrome.loadTimes();firstPaint=loadTimes.firstPaintTime*1000;firstPaintTime=firstPaint-(loadTimes.startLoadTime*1000);console.info('First paint took',firstPaintTime,'ms');console.info('Load took',performance.timing.loadEventStart-performance.timing.navigationStart,'ms');var instances=0;if(parseFloat(Polymer.version)<1){instances=[].slice.call(document.querySelectorAll('html /deep/ *')).filter(function(el){return el.localName.indexOf('-')!=-1||el.getAttribute('is');}).length;}else{instances=Polymer.telemetry.instanceCount;}console.info('Custom element instances:',instances);var reflectCount=0;if(Polymer.telemetry){console.info('=== Properties set to reflectToAttribute ===');Polymer.telemetry.registrations.forEach(function(el){for(var prop in el.properties){if(el.properties[prop].reflectToAttribute){console.log(el.is+'.'+prop);reflectCount++;}}});}else{console.info('=== Properties set to reflect ===');Polymer.elements.forEach(function(el){for(var
@yuchi
yuchi / tele.md
Last active August 29, 2015 14:19
Comparison of telepresence software
@Youka
Youka / lua_myobject.cpp
Last active August 27, 2024 06:32
Example of Lua in C++ and userdata objects
// Lua C API
#include <lua.hpp>
// C++ input/output streams
#include <iostream>
// MyObject as C++ class
class MyObject{
private:
double x;
public:
@joshgreen
joshgreen / gist:d910c4e8ad01418ef929
Last active August 29, 2015 14:03
Sublime Text 3 User settings 20140901
{
"auto_complete": true,
"auto_indent": true,
"bold_folder_labels": true,
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"color_scheme": "Packages/User/predawn (SL).tmTheme",
"detect_slow_plugins": false,
"dictionary": "Packages/Language - English/en_GB.dic",
"draw_white_space": "selection",
@alojzije
alojzije / connectHTMLelements_SVG.png
Last active May 31, 2025 12:39
Connect two elements / draw a path between two elements with SVG path (using jQuery)
connectHTMLelements_SVG.png
(function () {
'use strict';
var wow = ['', 'wow\n'];
var adjs = 'so such many much very'.split(' ');
var colr = ['ff0000', '00ff00', '0000ff'];
var randomizr = function (a) {
return a[Math.floor(Math.random() * a.length)];
@JiaxiangZheng
JiaxiangZheng / json_encoding_demo.go
Created February 24, 2014 08:47
This file demonstrates golang's json library to encode&decode, marshal&unmarshal json data.
package main
import (
"encoding/json"
"fmt"
"os"
"log"
)
// 主要是靠Marshal和Unmarshal函数进行解析与读取