Skip to content

Instantly share code, notes, and snippets.

// TODO:
// * touch controls
// * allow late piece rotation
// * code cleanup
//--------------------------------------------------//
// PAGE OBJECT & LOGIC //
//--------------------------------------------------//
<script>
try {
(function() {
if (typeof(lpcurruser) == 'undefined') lpcurruser = '';
if (document.getElementById('lpcurruserelt') && document.getElementById('lpcurruserelt').value != '') {
lpcurruser = document.getElementById('lpcurruserelt').value;
document.getElementById('lpcurruserelt').value = '';
}
if (typeof(lpcurrpass) == 'undefined') lpcurrpass = '';
if (document.getElementById('lpcurrpasselt') && document.getElementById('lpcurrpasselt').value != '') {
@thaenor
thaenor / add.js
Last active January 24, 2018 10:19
A Js function to create a function add a set of number - #LIT
function add(x,y) {
var foo = "function customAdd(";
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
foo += arguments[0];
for (var i = 1; i < arguments.length; i++){
if(typeof arguments[i] != "number"){
throw new Error("you cheater");
}
foo += "," + arguments[i];
@thaenor
thaenor / index.html
Created November 9, 2017 16:15
How I'm calling Google API in Electron
<script>
if (typeof module === 'object') {
window.module = module; module = undefined;
}
</script>
<script async defer src="https://apis.google.com/js/api.js" onload="this.onload=function(){};handleClientLoad()" onreadystatechange="if (this.readyState === 'complete') this.onload()"></script>
<script>
if (window.module)
@thaenor
thaenor / app.js
Created July 17, 2017 12:20
excel uploader/parser
const express = require('express')
const app = express()
const router = express.Router();
const multer = require('multer')
const upload = multer({ dest: 'uploads/' })
const Parse = require('csv-parse');
const fs = require('fs');
app.use(express.static(__dirname + '/'));
function parseCSVFile(sourceFilePath, columns, onNewRecord, handleError, done){
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<input id="filep" type="file" onchange="foo()">
<div id="result"></div>
@thaenor
thaenor / react.js
Last active February 22, 2017 16:21
React Notes - because I'm tired of making pens
//If a child component wants to communicate back to its parent, it can do so through props,
//most commonly by its parent providing a callback property that the child can call when some event happens:
const ParentComponent = () => {
const letMeKnowAboutSomeThing = () => console.log('something happened!')
return (
<ChildComponent letMeKnowAboutSomeThing={letMeKnowAboutSomeThing} />
)
}
@thaenor
thaenor / index.html
Created January 18, 2017 23:54 — forked from anonymous/index.html
JS Bin // source https://jsbin.com/toqaka
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<div id="root"></div>