Skip to content

Instantly share code, notes, and snippets.

View jakewtaylor's full-sized avatar

Jake Taylor jakewtaylor

View GitHub Profile
// Ensures tailwind intellisense works in non-standard places that we want
"tailwindCSS.experimental.classRegex": [
// for usages like: clsx('bg-accent')
["clsx\\(([^)]*)\\)", "(?:'|\")([^'\"]*)(?:'|\")"],
// within our Theme definition objects
[": Theme<[^>]*>([^;]*)", ":\\s*?[\"'`]([^\"'`]*).*?,?"]
],
@jakewtaylor
jakewtaylor / History|-486adb29|entries.json
Created October 15, 2022 01:35
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///Users/jake/code/bin-scraper/app/root.tsx","entries":[{"id":"3wXE.tsx","timestamp":1665758642740}]}

Template Component

Counter.tsx

import React, { useState, useCallback } from 'react';
import { View, Text, TextInput, TouchableHighlight } from 'react-native';
import { connect } from 'react-redux';
import { Dispatch } from 'redux';
import { styles } from './Counter.styles';
import { useMemo } from 'react';
export const makeUseStyles = cb => (...args) => {
const styleObj = useMemo(() => cb(...args), args);
const styleSheet = useMemo(() => {
return Object.entries(styleObj).reduce((acc, [className, classes]) => {
acc[className] = classes.join(' ');
return acc;
@jakewtaylor
jakewtaylor / extensions.sh
Created October 11, 2019 15:27
Latest VS Code settings
code --install-extension akamud.vscode-theme-onedark
code --install-extension be5invis.vscode-custom-css
code --install-extension bmewburn.vscode-intelephense-client
code --install-extension bradlc.vscode-tailwindcss
code --install-extension codingyu.laravel-goto-view
code --install-extension cpylua.language-postcss
code --install-extension dbaeumer.vscode-eslint
code --install-extension dollyn.line-counter
code --install-extension ericadamski.carbon-now-sh
code --install-extension esbenp.prettier-vscode
<?php
namespace App\Helpers;
use Illuminate\Support\Collection;
class Piper
{
/**
* The symbol that will be replaced with the current value.
const delay = (ms, token = null) => new Promise((resolve, reject) => {
const cancelled = () => reject({ cancelled: true });
if (token && token.cancelled) {
return cancelled();
}
const timeout = setTimeout(() => {
if (!token || !token.cancelled) {
resolve();
<?php
/*
* This will still be mutable
*/
use Carbon\Carbon;
$date = Carbon::now();
/*
@jakewtaylor
jakewtaylor / AppServiceProvider.php
Created March 6, 2019 09:59
How to use CarbonImmutable Laravel 5.8
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
// The Date facade
use Illuminate\Support\Facades\Date;
// And the CarbonImmutable class
@jakewtaylor
jakewtaylor / example.php
Created March 6, 2019 09:41
Carbon 2.0 Immutable demonstration
<?php
$mutable = Carbon::now();
$immutable = CarbonImmutable::now();
$modifiedMutable = $mutable->add(1, 'day');
$modifiedImmutable = CarbonImmutable::now()->add(1, 'day');
var_dump($modifiedMutable === $mutable); // bool(true)
var_dump($mutable->isoFormat('dddd D')); // string(8) "Sunday 3"
var_dump($modifiedMutable->isoFormat('dddd D')); // string(8) "Sunday 3"