Skip to content

Instantly share code, notes, and snippets.

View takempf's full-sized avatar

Timothy Kempf takempf

View GitHub Profile

Eliminating aliasing for elements with 3D rotation applied

Sometimes, when you apply a 3D rotation to an element within a perspective parent, it will have aliased edges.

image

This can be fixed by adding outline: 1px solid transparent to the element with the transform:

.rotatedElement {
@takempf
takempf / Code.gs
Last active April 25, 2023 05:19
A basic "Multiselect" Apps Script for Google Sheets
// SCRIPT CONFIGURATION
// Change the configuration values below to make everything work.
// MULTI_CHOICE_CELLS
// This is a string in "A1 Notation". Simply specify which cells you would
// like to have "multiselect" functionality the same way you specify cells
// inside Google Sheets
//
// const MULTI_CHOICE_CELLS = 'Sheet1!A1:C3,Sheet2!D5:E6';
@takempf
takempf / gist:b2fb4cc12a93805b942bfb7d306e7790
Created July 21, 2020 20:41
Onfleet Google Geocoding Doc
Problem
Due new requirements from Google Geocoding API guideline, they are categorizing strictness on the apartment/office buildings.
They are now qualified as GEOMETRIC_CENTER. However, due to their own guideline, we can’t accept geometric_center as a valid address.
There is some situation with our system that we are in the process of changing but not quite there.
Depending on how the address field is sent in. We can tackle this problem using my workaround for now.
Here’s a valid address that would used to work:
@takempf
takempf / index.js
Last active July 21, 2017 18:30
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const decomp = require('poly-decomp');
window.decomp = decomp;
const Matter = require('matter-js');
const { PI } = Math;
@takempf
takempf / download-mortys.js
Last active September 9, 2016 00:30
Quick script for downloading mortys from a popular Pocket Mortys website for emoji purposes.
const fs = require('fs');
const _ = require('lodash');
const request = require('request');
const mortyData = require('./morty-data.js');
const MORTY_ICON_BASE_URL = 'https://pocketmortys.net/images/heads';
const downloadMorty = function (morty) {
@takempf
takempf / gist:014e94b74fd7d4d5d70c
Created October 26, 2014 22:32
Poopy asyncSeek method, because <video> doesn't have one by default.
var asyncSeek = function( video, time, callback ){
var doneSeeking = function(){
video.removeEventListener( 'seeked', doneSeeking );
if( callback ) callback();
};
video.addEventListener( 'seeked', doneSeeking );
video.currentTime = time;
};
module.exports = asyncSeek;
@takempf
takempf / notes.md
Last active August 29, 2015 14:08
How to find, make, and use GIFs in your daily life
@takempf
takempf / comment.js
Last active June 23, 2016 01:41
Get a random popular Dribbble comment.
var NO_OP = function(){};
// randomly choose one of dribbble's popular shots
// keep choosing until we get one with comments
var getRandomShotId = function( callback ){
var getRandomShot = function( shots ){
var random_index = Math.floor(Math.random()*shots.length);
var shot = shots[random_index];
if( shot.comments_count === 0 ){
return getRandomShot( shots );
@takempf
takempf / index.js
Last active August 29, 2015 14:02
Poopy lil' form value parser
var dom = require('domquery');
var domready = require('domready');
var forEach = Array.prototype.forEach;
var getFormData = function( form ){
var form_data = {};
forEach.call( form.elements, function( el, i ){
switch( el.tagName ){
case 'INPUT':
case 'TEXTAREA':
@takempf
takempf / gist:9868613
Created March 30, 2014 06:35
geochat issue
Uncaught exception: Error: Firebase.child failed: First argument was an invalid path: "null". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"
Error thrown at line 3, column 2 in g(a) in https://cdn.firebase.com/v0/firebase.js:
throw a;
called from line 275, column 2 in Ia(a, b) in https://cdn.firebase.com/v0/firebase.js:
(!u(b) || 0 === b.length || ya.test(b)) && g(Error(A(a, 1, l) + 'was an invalid path: "' + b + '". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"'))
called from line 3844, column 4 in <anonymous function: H.prototype.F>(a) in https://cdn.firebase.com/v0/firebase.js:
Ia("Firebase.child", a);
called from line 106, column 2 in createUserNode(username) in https://dl.dropboxusercontent.com/u/1330446/geochat/js/scripts.js:
userRef = allUserRef.child(username);