Skip to content

Instantly share code, notes, and snippets.

@clayperez
clayperez / 2023Growler.geojson
Last active March 6, 2023 17:25
This file contains GEOJSON data representing the Levi's GranFondo "Growler" route.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@clayperez
clayperez / 2023Growler.gpx
Created March 6, 2023 16:37
Levi's GranFondo Growler Route 2023
<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="StravaGPX" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" xmlns="http://www.topografix.com/GPX/1/1">
<metadata>
<name>Growler</name>
<author>
<name>Carlos Perez</name>
<link href="https://www.strava.com/athletes/110895"/>
</author>
<copyright author="OpenStreetMap contributors">
<year>2020</year>
@clayperez
clayperez / reset-webflow-form.js
Created December 22, 2022 18:41 — forked from cspags/reset-webflow-form.js
Webflow - Reset a form to it's original state after it is submitted, instead of showing the success message
$(function() {
/*** START SCRIPT CONFIG ***/
// Replace with value for your form. ie. "#your-form-id" or ".your-form-class"
var FORM_SELECTOR = ".recipe-form";
// Do you want to hide the success message after the form is submitted?
var HIDE_SUCCESS_MESSAGE = false;
// Do you want the success message to show above the form?
@clayperez
clayperez / convertToJPG
Created August 4, 2022 00:08 — forked from mikey0000/convertToJPG
convert png to jpeg using javascript and write back to original file
function convertDataURIToBinary(dataURI) {
var BASE64_MARKER = ';base64,';
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
var base64 = dataURI.substring(base64Index);
var raw = window.atob(base64);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));
for (i = 0; i < rawLength; i++) {
array[i] = raw.charCodeAt(i);
@clayperez
clayperez / RhesusModelSet.js
Last active December 4, 2020 20:06
Rhesus Model Setup
import { Model } from '@vuex-orm/core'
// FASTER UID
let count = 0
const myUid = () => ++count
export class Category extends Model {
static entity = 'categories'
static fields() {
@clayperez
clayperez / vTippyMixin.js
Created April 16, 2020 15:52
Enhanced Vue-Tippy interaction behavior MIXIN.
// CCP: ENHACED VUE-TIPPY FUNCTIONALITY
// -------------------------- //
// Author: Carlos Perez
// Bike Monkey Inc.
// https://www.bikemonkey.net
// [email protected]
// -------------------------- //
// License: Do whatevah you want with this. Just throw back some enhancements!
// -------------------------- //
// This mixin modifies the behavior of the vue-tippy settings
@clayperez
clayperez / Code.gs
Created December 18, 2019 14:53
AUTO-Generate Unique IDs in Google Sheets
// AUTO GENERATE SIMPLE UNIQUE ID'S FOR NON-EMPTY ROWS
//
// Author: Carlos Perez, [email protected]
//
// Purpose: This Google Sheets script fires when any cell is edited and
// inserts a random (reasonably unique) UID of ID_LENGTH length
// into the specified ID_COLUMN. For instance if the first column in the
// sheet specified by SHEETNAME is the column where you would like the
// UID injected, then ID_COLUMN should be 1.
//
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="results">
<h3>Display results here from VUE</h3>
<!-- Angel, work in here -->
</div>
<script>
// QUICK GOOGLE SPREADSHEET QUERY
@clayperez
clayperez / jsQueryParse.html
Created January 17, 2018 18:41
JAVASCRIPT QUERY STRING PARSING
<script src="https://cdn.jsdelivr.net/jquery/3.1.1/jquery.min.js"></script>
<script>
/// Convert query string to JSON
function getJsonFromUrl(hashBased) {
var query;
if(hashBased) {
var pos = location.href.indexOf("?");
if(pos==-1) return [];
query = location.href.substr(pos+1);
} else {
@clayperez
clayperez / join
Created September 23, 2017 20:57
JOIN CSV FILES
#!/bin/bash
DATETIME=$(date +%Y%m%d)
echo "MOVE ALL CSV FILES INTO A SINGLE FILE."
echo "join [outputfile]"
mkdir output
mkdir ./output/$1_$DATETIME
cat *.csv >./output/$1_$DATETIME.csv
mv *.csv ./output/$1_$DATETIME
open ./output