Skip to content

Instantly share code, notes, and snippets.

View lonelydatum's full-sized avatar
💭
working on prequilt

Gar lonelydatum

💭
working on prequilt
View GitHub Profile
getOffset(obj) {
var offsetLeft = 0;
var offsetTop = 0;
do {
if (!isNaN(obj.offsetLeft)) {
offsetLeft += obj.offsetLeft;
}
if (!isNaN(obj.offsetTop)) {
offsetTop += obj.offsetTop;
}
@lonelydatum
lonelydatum / Checker.js
Last active October 28, 2016 01:15
Makes checker. Pass in size of square
function makeChecker(size=1) {
const black = '#000000'
const white = '#FFFFFF'
const w = canvas.width/size
const h = canvas.height/size
let yColor = black
// let yColor = white
for(let y=0; y<h; y++) {
var fs = require('fs')
var stream = fs.createReadStream(filePath, {flags: 'r', encoding: 'utf-8'});
var buf = '';
stream.on('data', function(d) {
buf += d.toString(); // when data is read, stash it in a string buffer
pump(); // then process the buffer
});
<snippet>
<content><![CDATA[
var Frame = require('../../_common/js/Frame.js');
class Frame${1:1} extends Frame{
addImages(){
var gulp = require('gulp');
var reactify = require('reactify');
var browserify = require('gulp-browserify');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
function swallowError(error){
console.log(error.toString());
this.emit('end');
}
@lonelydatum
lonelydatum / angular.html
Last active August 29, 2015 14:16
angular
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body ng-app="myApp">
<div ng-controller="Ctrl">
@lonelydatum
lonelydatum / 01-skeleton.html
Last active August 29, 2015 14:16
canvas skeleton
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="../include/style.css">
</head>
<body>
<canvas id="canvas" width="400" height="400"></canvas>
<script>
@lonelydatum
lonelydatum / designer.html
Last active August 29, 2015 14:15
designer
<link rel="import" href="../yt-video/yt-search-video.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
'use strict';
var
LIVERELOAD_PORT = 35729,
lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT }),
mountFolder = function( connect, dir ) {
return connect.static(require('path').resolve(dir));
};
module.exports = function( grunt ) {
'use strict';
var
LIVERELOAD_PORT = 35729,
lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT }),
mountFolder = function( connect, dir ) {
return connect.static(require('path').resolve(dir));
};
module.exports = function( grunt ) {