View visible.js
import React from 'react';
const visible = isVisible => Component => {
class VisibleComponent extends React.Component {
componentDidMount() {
this.unsubscribe = this.context.store.subscribe(this.handleChange.bind(this));
}
componentWillUnmount() {
this.unsubscribe();
View csv.js
// Usage:
// const records = [['James', 'james@james.com'], ['Steve', 'steve@steve.com']];
// const titles = ['name', 'email'];
// generateCsv(records, titles);
// RFC 4180
// Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes.
const formatValue = value => {
const chars = [',', '"', '\n'];
const mustBeEnclosed = chars.some(c => value.includes(c));
View index.js
const attempts = [
[ 1.613, 4.2010000000000005, 13.652000000000001, 7.035, 5.371, 9.951, 8.934000000000001, 5.534, 4.251, 7.636, 15.402000000000001, 6.384 ],
[ 1.401, 5.051, 11.852, 5.534, 3.384, 4.95, 6.501, 7.1850000000000005, 5.702, 5.401, 10.685, 5.867 ],
[ 1.349, 3.984, 9.401, 2.983, 4.0840000000000005, 5.05, 6.939, 5.7170000000000005, 3.517, 3.384, 9.185, 6.417 ],
];
const levels = [];
for (let i = 0; i < attempts[0].length; i++) {
View index.js
const lngRadius = 0.25;
const point = {
lat: 51.507351,
lng: -0.127758,
};
const latmin = point.lat - lngRadius;
const latmax = point.lat + lngRadius;
const lngmin = point.lng - (lngRadius / 85 * 180); // Number of units different from lng so need to calculate
View index.js
const countHoriz = 24;
// 16, 24
const width = 960;
const height = 600;
const squareSize = width / countHoriz;
const countVert = height / squareSize
View jsx-comment.sublime-snippet
<snippet>
<content><![CDATA[
{/* ${1:JSX Comment} */}
]]></content>
<!-- Hit `jc` in any JS document to get a JSX comment -->
<tabTrigger>jc</tabTrigger>
<scope>source.js</scope>
</snippet>
View script.sh
# Bash domain checker
# Usage: sh script.sh [domain name]
# If it says "No match for [domain]", it is available.
tlds=("com" "net" "co" "io" "co.uk")
for tld in "${tlds[@]}"
do
whois "$1.$tld" | grep "No match for";
done
View pubsub.js
//events - a super-basic Javascript (publish subscribe) pattern
var events = {
events: {},
on: function (eventName, fn) {
this.events[eventName] = this.events[eventName] || [];
this.events[eventName].push(fn);
},
off: function(eventName, fn) {
if (this.events[eventName]) {
View console-log.sublime-snippet
<snippet>
<content><![CDATA[console.log('$1', $1);]]></content>
<tabTrigger>log</tabTrigger>
<scope>text.html,source.js,source.jsx</scope>
<description>console.log()</description>
</snippet>
View lingos.md

Languages

Early Languages (1960s and earlier)

  • COBOL: Probably the first language that looked "human readable". Invented with "business" in mind, ie, banks, corporations, etc. Still in use at many financial places as their installations are huge and would be expensive to replace/rewrite. COBOL programmers are very hard to find and very expensive.

  • Fortran: Developed at IBM in the 1950s, still incredibly popular today for economics calculations, math, finance, etc. Popular in academia for this reason.

  • C: Massively influential. probably the most famous programming language. Invented at Bell Labs in the 60s. Still in incredibly wide use for such applications as operating systems, microcontrollers, or anything where speed is a necessary. Very fast, but easy to write buggy code. Runs on almost any hardware ever made. It's syntax and idioms live on in Java, JavaScript, C#, C++

Middle-aged languages (1970s & 1980s)