Skip to content

Instantly share code, notes, and snippets.

View kevinchisholm's full-sized avatar

Kevin Chisholm kevinchisholm

View GitHub Profile
@kevinchisholm
kevinchisholm / getYoutubeVideoId.js
Last active December 24, 2017 14:35
Get the ID from a YouTube Video URL
//set variables
var videoId = '',
youTubeUrlBase = 'https://www.youtube.com/watch?v=',
youTubeUrl = 'https://www.youtube.com/watch?v=JMP3MUwoEmw';
//returns the youtube ID from a URL
function getYoutubeId (url){
var myregexp = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i,
retArr = url.match(myregexp);
@kevinchisholm
kevinchisholm / console-to-dom.js
Last active November 21, 2017 19:50
Show console.log output in the DOM
(function () {
var $consoleLog = $('<div id="console-log"></div>'),
newLine = function(){return $('<p class="console-line"></p>'); },
cssText = '.console-line{margin:10px;padding:10px;background-color:#ededed;border:1px solid #ccc;font-weight:700;font-family:monospace;color:#333;font-size:18px}.dir{background-color:#80e5a6}.info{background-color:#cff}.warn{background-color:#fdfd96}.error{background-color:#ff6961}',
$style = $('<style>' + cssText + '</style>');
//reminder: jQuery is a dependency!
$('body').prepend($consoleLog);
$('body').append($style);
@kevinchisholm
kevinchisholm / angular2-http-observables-five-minutes.md
Last active December 24, 2017 15:00
Angular2 HTTP Observables in Five Minutes

RxJS Logo

Example code for the blog post: Angular2 HTTP Observables in Five Minutes

@kevinchisholm
kevinchisholm / __node-js-express-static-web-server-in-five-minutes.md
Last active April 26, 2018 04:59
Set Up A Node / Express Static Web Server In Five Minutes
@kevinchisholm
kevinchisholm / _JavaScript-LET-vs-CONST.md
Last active January 3, 2018 00:04
What is the difference between LET and CONST in JavaScript?
@kevinchisholm
kevinchisholm / _mapbox-maps-sdk-for-react-native.md
Last active December 24, 2017 21:37
Getting Started with the Mapbox Maps SDK for React Native
@kevinchisholm
kevinchisholm / App.js
Last active May 26, 2020 12:43
How to show points on a mapbox map with react native
import React, {Component} from 'react';
import {View, Image} from 'react-native';
import MapboxGL from '@mapbox/react-native-mapbox-gl';
MapboxGL.setAccessToken(YOUR_ACCESS_TOKEN);
const coordinates = [
[-73.98330688476561, 40.76975180901395],
[-73.96682739257812, 40.761560925502806],
[-74.00751113891602, 40.746346606483826],
@kevinchisholm
kevinchisholm / _detect-text-input-change-event.md
Last active January 5, 2018 09:47
How Do I Detect A Text-input Change Event With Angular ?