Skip to content

Instantly share code, notes, and snippets.

View amaxwell01's full-sized avatar

Andrew Maxwell amaxwell01

View GitHub Profile
const BLOCK_TAGS = {
p: 'paragraph',
li: 'list-item',
ul: 'bulleted-list',
ol: 'numbered-list',
blockquote: 'quote',
pre: 'code',
h1: 'heading-one',
h2: 'heading-two',
h3: 'heading-three',
// create the single note view where the user can edit it
import React, { Component } from 'react';
import render from 'react-dom';
import { Link } from 'react-router';
import { connect } from 'react-redux';
import { Editor } from 'slate-react'
import SlateHtml from 'slate-html-serializer';
import { State } from 'slate';
import * as parse5 from 'parse5';
import NotesContainer from '../../containers/NotesContainer';
@amaxwell01
amaxwell01 / index.html
Created May 21, 2016 18:37
requestAnimationFrame
<div id="SomeElementYouWantToAnimate"></div>
@amaxwell01
amaxwell01 / googlePlayTVShows.js
Created May 7, 2016 05:06
Get an array of objects with tv show name and episodes, in my Google Play movies colletion
/*
* Return a Array of objects with tv show name and episodes, in my Google Play movies colletion
* https://play.google.com/movies
* Must be signed in and viewing the page for this to work
* Created by: Andrew Maxwell
* Created on: May 6th, 2016
*/
var tvShowsList = Array.prototype.slice.call(document.querySelectorAll('#body-content > div > div > div.main-content > div > div:nth-child(2) > div.tvshow-library > div'));
var getEpisodes = function(episodes) {
episodeNames = episodes.map(function(episode) {
@amaxwell01
amaxwell01 / googlePlayMovies.js
Created May 7, 2016 05:04
Get a list of movie names from my Google Play Movies collection
/*
* Return a Array of movie names in my Google Play movies colletion
* https://play.google.com/movies
* Must be signed in and viewing the page for this to work
* Created by: Andrew Maxwell
* Created on: May 6th, 2016
*/
var movieList = Array.prototype.slice.call(document.querySelectorAll('#body-content > div > div > div.main-content > div > div:nth-child(2) > div.id-cluster-container.cluster-container > div > div.id-card-list.card-list.two-cards > div'));
var movies = movieList.map(function(movie) {
var movieName = movie.innerText;
@amaxwell01
amaxwell01 / viewport-shots.js
Created May 1, 2016 18:32
Takes provided URL passed as argument and make full height screenshots of this page * with several viewport widths using Nightwatch.js with Selenium.
/*
* Takes provided URL passed as argument and make full height screenshots of this page
* with several viewport widths using Nightwatch.js with Selenium.
*
* These viewport widths are taken from common android and iOS devices. Modify as needed.
*
* Takes an optional second argument for the path where screenshots are saved.
*
* Usage:
* $ node node_modules/.bin/nightwatch -t viewport-shots.js http://example.com
<snippet>
<content><![CDATA[
/* ==========================================================================
Bug #${1:12345} - ACM - ${2:01/01/14}
* ${3:Reason}
========================================================================== */
]]></content>
<tabTrigger>jsBug</tabTrigger>
</snippet>
<snippet>
<content><![CDATA[
/* ===========================================================================
${1:title}
* ${2:content}
*
* @param <String> tag
* @return <Element> element
========================================================================== */
]]></content>
@amaxwell01
amaxwell01 / fizzbuzz.js
Created August 6, 2013 19:43
Fizzbuzz in JavaScript
var increment;
for ( increment = 0; increment < 100; increment++ ) {
if ( increment % 15 === 0 ) {
console.log( 'fizzbuzz' );
} else if ( increment % 3 === 0 ) {
console.log( 'fizz' );
} else if ( increment % 5 === 0 ) {
console.log( 'buzz' );
} else {
@amaxwell01
amaxwell01 / javascript_class.js
Created August 6, 2013 19:42
Creating Classes in JavaScript
var user = function(name, age, sex, job) {
this.name = name;
this.age = age;
this.sex = sex;
this.job = job;
};
var andrew = new user('Andrew', 28, 'Male', 'Engineer');
var whitney = new user('Whitney', 27, 'Female', 'Mom');