Skip to content

Instantly share code, notes, and snippets.

View markthethomas's full-sized avatar

Mark Thomas markthethomas

View GitHub Profile

Keybase proof

I hereby claim:

  • I am markthethomas on github.
  • I am markthomas (https://keybase.io/markthomas) on keybase.
  • I have a public key ASBX7E3tfj4Dkt9PCb69PcqOKiemYrdB4q_yRyi4QaNMywo

To claim this, I am signing this object:

@markthethomas
markthethomas / index.html
Created October 1, 2017 06:39
Lifecycle methods in React
<div id="root">
<!-- This div's content will be managed by React. -->
</div>
@markthethomas
markthethomas / React Native sample.js
Created August 17, 2017 15:17
React Native sample created by markthethomas - https://repl.it/KOAE/3
import React, { Component } from 'react';
import { Text, View, StyleSheet } from 'react-native';
export default class WhyReactNativeIsSoGreat extends Component {
render() {
return (
<View>
<Text>
If you like React on the web, you'll like React Native.
</Text>
@markthethomas
markthethomas / index.ios-2.js
Created November 18, 2015 17:14
react native part 3
'use strict';
const React = require('react-native');
const {
AppRegistry,
StyleSheet,
Text,
Image,
View,
} = React;
@markthethomas
markthethomas / index.ios-1.js
Created November 18, 2015 17:13
react native quickstart part 2
'use strict';
const React = require('react-native');
// We need to include the Image component type so we can use it
const {
AppRegistry,
StyleSheet,
Text,
Image,
@markthethomas
markthethomas / index.ios-0.js
Created November 18, 2015 17:11
React native quickstart
'use strict';
const React = require('react-native');
let {
AppRegistry,
StyleSheet,
Text,
View,
Image,
} = React;
@markthethomas
markthethomas / favorites.json
Created November 1, 2015 23:33
Npm Favorites
{
"global": {
"devDependencies": {
"babel": "^6.0.14",
"eslint": "^1.8.0",
"mocha": "^2.3.3",
"pm2": "^0.15.8",
"bluebird": "^3.0.5"
},
"dependencies": {
@markthethomas
markthethomas / count.js
Created September 24, 2015 15:56
Counting Arrays one-liner(s)
function count(array) {
return array.reduce((accumulator, current) => {
accumulator[current] = ++accumulator[current] || 1;
return accumulator;
}, {});
}
// Explanation: takes in an array and iterates over it with the reduce function. A callback is fired on each
// item in the array, with an accumulator and current value as args. The key thing is seeing that the default value of
// the accumulator is set to an object that we can write to ({}). Then, as we iterate through the values,
@markthethomas
markthethomas / Dockerfile
Last active October 10, 2015 16:01
Example node dockerfile
#using debian:jessie for it's smaller size over ubuntu
FROM debian:jessie
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Set environment variables
ENV appDir /var/www/app/current
# Run updates and install deps
@markthethomas
markthethomas / callSite.js
Created July 13, 2015 22:00
Name example -- calbacks
'use strict';
require('babel/register');
var ourModule = require('./example'),
chalk = require('chalk');
ourModule('Mark', function(err, message) {
if (err) {
console.error(err);