Skip to content

Instantly share code, notes, and snippets.

View jeshuamaxey's full-sized avatar

Jeshua Maxey jeshuamaxey

View GitHub Profile
@jeshuamaxey
jeshuamaxey / days.js
Created July 30, 2015 14:41
Javascript arrays of day and month names, short and long as well as an array of the number of days in each month.
//long
var DAYS = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'];
@jeshuamaxey
jeshuamaxey / _fonts.scss
Created July 29, 2015 10:34
Import required fonts from head bootstrap. Used for projects created using angular fullstack
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../bower_components/head-bootstrap/fonts/glyphicons-halflings-regular.eot');
src: url('../bower_components/head-bootstrap/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
url('../bower_components/head-bootstrap/fonts/glyphicons-halflings-regular.woff') format('woff'),
url('../bower_components/head-bootstrap/fonts/glyphicons-halflings-regular.ttf') format('truetype'),
url('../bower_components/head-bootstrap/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
@font-face {
div.navbar.navbar-default.navbar-inverse.navbar-static-top(ng-controller='NavbarCtrl')
div.container
div.navbar-header
button.navbar-toggle(type='button', ng-click='isCollapsed = !isCollapsed')
span.sr-only Toggle navigation
span.icon-bar
span.icon-bar
span.icon-bar
a.navbar-brand(href="/")
span.sprite-head-logo-white
@jeshuamaxey
jeshuamaxey / authed-agent.js
Last active December 10, 2017 18:21
A helper script which generates an authenticated user for testing angular fullstack API endpoints
/**
* adapted from code by chiyuk
* https://github.com/DaftMonk/generator-angular-fullstack/issues/494#issuecomment-62564718
*/
'use strict';
var app = require('../app');
var User = require('../api/user/user.model');
var request = require('supertest');
var Q = require('q');
# Starting Out In Tech
I was asked recently to give someone advice on how best to learn to code and become better acquainted with the startup and technology scene in London. I replied with a lengthy email and decided to put its contents in a publicly accessible place based on the feedback it received. I don't profess to be an expert on any of this stuff; these are my personal recommendations based on my 3 year's experience of working with technology in London.
## Learning to code
Everyone has a different opinion about how to get into coding. Putting to one side how to teach code to young kids, the majority recommend Python or Javascript. I recommend javascript because combined with HTML and CSS, which are relatively simple to pick up, it's very quick for beginners to see something tangible on the screen (ie a webpage) which I think motivates people to continue more than seeing a load of error messages which can be frightening for first timers.
That said, I've worked a lot with Decoded in the past who preac
@jeshuamaxey
jeshuamaxey / Flat UI Colours
Last active August 29, 2015 14:09
The Colours used in the Flat UI Bootstrap theme pulled out into an easy to copy-paste gist
// == Flat UI Colors
// == Credit: https://github.com/designmodo/Flat-UI
$turquoise: #1abc9c;
$green-sea: #16a085;
$emerald: #2ecc71;
$nephritis: #27ae60;
$peter-river: #3498db;
@jeshuamaxey
jeshuamaxey / json2csv.js
Created April 15, 2014 22:32
Small script to convert json data to csv
/*
* Small script to convert json data to csv
*/
var fs = require('fs');
var os = require('os');
//name of files
var dataFile = 'data.json';
var outputFile = 'output.csv';
@jeshuamaxey
jeshuamaxey / export-node-browser.js
Last active August 29, 2015 13:56
Pop this at the end of your node module and it can be used equally well in a browser too
/*
* all credit to @matteoagosti
* http://www.matteoagosti.com/blog/2013/02/24/writing-javascript-modules-for-both-browser-and-node/
*/
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
//export for node
module.exports = /*MODULE_OBJECT*/ ;
}
else {
@jeshuamaxey
jeshuamaxey / removeExt
Created July 19, 2013 18:09
A JavaScript function which removes all compounded file extensions of a string eg "file.js" => "file" "file.min.js" => "file" "file.v.0.04.min.js" => "file"
function removeExt(string) {
if(string == string.replace(/\.[^/.]+$/, ''))
return string;
else
return removeExt(string.replace(/\.[^/.]+$/, ''));
}
@jeshuamaxey
jeshuamaxey / Basic JavaScript Dictation
Created June 9, 2013 09:44
This is the bare minimum code to get voice dictation up and running with Chrome's new speech recognition API. Copy and paste into the JavaScript console, call the function and away you go.
function setupDictation() {
var recognizer = new webkitSpeechRecognition();
recognizer.continuous = true;
recognizer.interimResults = true;
recognizer.onresult = function(e) {
if (e.results.length) {
var lastResultIdx = e.resultIndex;
var message = e.results[lastResultIdx][0].transcript;
if(e.results[lastResultIdx].isFinal) {
console.log(message);