Skip to content

Instantly share code, notes, and snippets.

View matthewharwood's full-sized avatar
🎯
Focusing

matthew harwood matthewharwood

🎯
Focusing
View GitHub Profile
{
"localization": {
"default": "en",
"locales": [
"en",
"de",
"ja",
"zh"
]
}
@matthewharwood
matthewharwood / scripts.js
Created February 13, 2017 03:41
Make a triangle in webgl
import mat4 from '../node_modules/gl-matrix/src/gl-matrix/mat4';
const vertexShaderText = `
precision mediump float;
attribute vec2 vertPosition;
attribute vec3 vertColor;
varying vec3 fragColor;
void main() {
// This gist is to highlight a possible convience mixin to BEM practices.
// Note: Below mixins "p,c,m" do not directly adhere to the current atomic nomenclature or file structure.
// However, these example mixins could be prefixed/suffixed any which way to follow our nomenclature.
/** bem-mixins **/
@mixin p($parent-selector) {
.#{$parent-selector} {
@content;
}
}
//from terminal run
npm install express --save;
//server.js
var path = require('path');
var express = require('express');
@matthewharwood
matthewharwood / model.py
Created August 16, 2015 01:17
An ongoing example class of how to define models in python
from django.db import models
# Create your models here.
class Project(models.Model):
name = models.CharField(max_length=300)
def __unicode__(self):
return self.name
@matthewharwood
matthewharwood / Angular 2: Env. Setup
Last active August 29, 2015 14:21
Angular 2 Setup
Setting up Angular 2 Environment
===========================
----------
Install Package Managers
-------------
**Prerequisite:**
{
store_bucket: [{
city: "Chicago",
slug: "chicago-il-60603",
storeid: 2643947,
name: "CityTarget Chicago State St.",
tier: 3,
storeref: "2799",
postalcode: "60603",
promotions: [{
@matthewharwood
matthewharwood / Cache Provider
Created October 14, 2014 16:11
Use many controllers to create a cue of requests but only have one successful response store that response. The cue then return cache!
angular.module('giphyApp')
.factory('Gifs', function ($http, $q) {
var Gifs = {};
var cachedPromise = {};
var api = {
base: 'http://api.giphy.com/v1/gifs/search?q=',
auth: '&api_key=dc6zaTOxFJmzC'
};
@matthewharwood
matthewharwood / PubSub + Cache
Created October 13, 2014 20:56
Cache + pubsub pattern
angular.module('yoangApp')
.service('PubSubService', function () {
return {Initialize:Initialize};
function Initialize (scope, Cache) {
//Keep a dictionary to store the events and its subscriptions
var publishEventMap = {};
scope.Cache = Cache;