Skip to content

Instantly share code, notes, and snippets.

View piecedigital's full-sized avatar

Piece Digital piecedigital

  • United States
View GitHub Profile
frameData { // pixel data for the frame
l0: layer {
"0_0": { // the coordinates of the pixel
top,
right,
bottom,
left,
width,
height,
centerX,
function mouseGridPosition(e,
{
pixel,
w,
h
}) {
// w and h are the width and height of the canvas
var { canvas, context: ctx } = getCanvasAndContext();
var mX = e.offsetX;
frameData { // pixel data for the frame
"0_0": { // the coordinates of the pixel
top,
right,
bottom,
left,
width,
height,
centerX,
centerY,
"use strict";
const MDA = [1, 2, [3, 4], 5, [6, [7, 8, [9, [10]]]]];
let newArr = [];
// piecedigital.net
const flattenArray = function(arr) {
let newArr = [];
let flat = function(arr) {
arr.map(data => {
// chck if the data in the index of the array is an object and an array
if(typeof data === "object" && Array.isArray(data)) {
@piecedigital
piecedigital / maps.go
Last active March 30, 2016 23:51
Exercise: map. Implement WordCount. It should return a map of the counts of each “word” in the string s. The wc.Test function runs a test suite against the provided function and prints success or failure.
package main
import (
"golang.org/x/tour/wc"
"strings"
)
// I finally solved one that I didn't have to look up help for
func WordCount(s string) map[string]int {
// create a variable "stringSplit", a slice that contains all words from "s"
package main
import (
"golang.org/x/tour/pic"
)
func Pic(dx, dy int) [][]uint8 {
// this makes "s" a slice ready to hold slices
s := make([][]uint8, dy)
@piecedigital
piecedigital / gist:a4d8ddfd43acbecbc7ee
Created June 24, 2015 19:21
Automatic Tournament
var teams = ["foo", "bar", "baz", "fizz", "buzz", "biz"];
var bracket = [
{
},
{
},
{
@piecedigital
piecedigital / Single-Div-Mobile-Hamburger-Menu.markdown
Created March 17, 2015 08:16
Single Div Mobile/Hamburger Menu