Skip to content

Instantly share code, notes, and snippets.

View toklok's full-sized avatar
💭
Permanent 418 status

Joseph Curtis toklok

💭
Permanent 418 status
View GitHub Profile
@toklok
toklok / reverse_ga_transaction.js
Created August 10, 2020 14:45 — forked from gtempesta/reverse_ga_transaction.js
Reverse Enhanced Ecommerce Transaction in Google Analytics
// Reverse purchase in Google Analytics with Enhanced Ecommerce
// Source: https://support.google.com/analytics/answer/1037443?hl=en
var items = [
{
id: 573, // original ID
price: "57000.00", // original price
quantity: "-2500" // negative quantity
},
@toklok
toklok / reverse_ga_transaction.js
Created August 10, 2020 14:45 — forked from gtempesta/reverse_ga_transaction.js
Reverse Enhanced Ecommerce Transaction in Google Analytics
// Reverse purchase in Google Analytics with Enhanced Ecommerce
// Source: https://support.google.com/analytics/answer/1037443?hl=en
var items = [
{
id: 573, // original ID
price: "57000.00", // original price
quantity: "-2500" // negative quantity
},
const { src, dest, watch, series, parallel, lastRun } = require('gulp')
const pipeline = require('stream').pipeline
const fs = require('fs')
const sass = require('gulp-sass')
const changed = require('gulp-changed')
const imagemin = require('gulp-imagemin')
const flatten = require('gulp-flatten')
const gulpif = require('gulp-if')
const cssnano = require('gulp-cssnano')
const rename = require('gulp-rename')
@toklok
toklok / mona-lisa-vml.html
Created January 9, 2020 17:01 — forked from hteumeuleu/mona-lisa-vml.html
Mona Lisa in VML
<!DOCTYPE html>
<html lang="en" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:w="urn:schemas-microsoft-com:office:wordml"
xmlns:wx="urn:schemas-microsoft-com:office:auxHint">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Preview</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
@toklok
toklok / firefox-developer-edition.md
Created October 24, 2019 13:39 — forked from mahammad/firefox-developer-edition.md
How To install Firefox Developer Edition and create desktop icon for Ubuntu 14.04 LTS

chose other install way

  1. Open Terminal Ctrl+Alt+T Download Firefox Developer Edition tar file

    wget https://download.mozilla.org/?product=firefox-aurora-latest-ssl&os=linux64&lang=en-US

  2. Copy tar file to opt sudo cp -rp firefox-35.0a2.en-US.linux-x86_64.tar.bz2

  3. Open opt folder (cd /opt/) and untar file sudo tar xjf firefox-35.0a2.en-US.linux-x86_64.tar.bz2

@toklok
toklok / README.md
Created February 20, 2019 18:19 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@toklok
toklok / removeItemFromObject.js
Created February 1, 2019 03:33 — forked from Dindaleon/removeItemFromObject.js
How to remove an item from object without mutating it
// To remove an item from an array by id:
return state.filter(item => item.id !== action.id)
// To remove a key from an object by id:
let copy = Object.assign({}, state) // assuming you use Object.assign() polyfill!
delete copy[action.id] // shallowly mutating a shallow copy is fine
return copy
// (Bonus) The same with object spread operator proposal:
import React, { useState, useMemo } from "react"
import { calculateTotals } from "./utils"
export default function SelectTickets({
context: { workshopData, subscriberCode },
send
}) {
let initialTicketsToPurchase = useMemo(
() =>
workshopData.ticketTypes.reduce((ticketsToPurchase, type, index) => {

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@toklok
toklok / Tabs.tsx
Created January 18, 2019 18:37 — forked from ryanflorence/Tabs.tsx
import React, {
cloneElement,
useState,
useEffect,
useRef,
HTMLAttributes,
ReactElement
} from "react";
////////////////////////////////////////////////////////////////////////////////