Skip to content

Instantly share code, notes, and snippets.

View callumlocke's full-sized avatar

Callum Locke callumlocke

View GitHub Profile
@BrianCodeItUp
BrianCodeItUp / component.tsx
Last active May 12, 2022 06:43
useContext, useReducer with typescript
import React from 'react';
import { View, Text, Button } from 'react-native';
import styles from './styles'
import { ContextProvider, Context } from './context';
const Compo = () => {
const { type } = useContext(Context);
return (
<View style={styles.container}>
<Text>{type}</Text>
@serg0x
serg0x / material-design-shadows.css
Last active July 7, 2023 13:33
Google material design elevation system shadows as css. Based on https://material.io/design/environment/elevation.html#default-elevations Exported with Sketchapp from the Google material design theme editor plugin "Baseline" theme.
/* Shadow 0dp */
box-shadow: none;
/* Shadow 1dp */
box-shadow: 0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 3px 0 rgba(0,0,0,0.20);
/* Shadow 2dp */
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.20);
/* Shadow 3dp */
@jonathantneal
jonathantneal / README.md
Last active November 5, 2023 05:42
Practical ARIA Tabs: Creating fully accessible tabs

Practical ARIA Tabs

This is a small guide to marking up fully accessible tabs. Consider using PostHTML ARIA Tabs as a practical solution.

The Rules

  1. Add tablist role to the <ul> to indicate it contains tabs.
  2. Add presentation role to each <li> to bypass its list item state.
  3. Add tab role to each <a> to incidate it is an actual tab.
  4. Add href and aria-controls to each <a> to reference its tab panel.
@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active April 25, 2024 04:16
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@MadeByMike
MadeByMike / bling.js
Last active July 23, 2021 12:32 — forked from paulirish/bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document)
Node.prototype.on = window.on = function (name, delegate, fn) {
var f
var target = this, match = false
var matches = this.matchesSelector || this.mozMatchesSelector || this.webkitMatchesSelector || this.oMatchesSelector || (function (name) {
$(name).forEach(function (elm) {
if (elm === target){

micromatch vs. minimatch (WIP)

Can micromatch be used as a drop-in replacement for minimatch?

For mainstream features, I tried to keep as much parity as possible between micromatch and minimatch. But there are some differences.

Key differences

  • the main minimatch function, minimatch(), works like micromatch.isMatch()
  • the main micromatch function, micromatch(), works like multimatch, with support for multiple patterns.
Heh
Anyway
Obviously it's not a huge deal
It just makes me sad
I like Node
And I can write Node
I just don't use it for anything
I like JS
And I can write JS
I just prefer CoffeeScript for day to day use
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@Darep
Darep / item.rb
Created January 24, 2013 19:15
Ruby on Rails concern example: making an ActiveRecord item sortable. Adapted from: http://say26.com/show-us-your-production-code-1-concerns
# app/models/item.rb
require 'concerns/sortable'
class Item < ActiveRecord::Base
include Sortable
attr_accessible :title
end
@nicdaCosta
nicdaCosta / Grep.js
Last active March 9, 2024 13:39
Basic function that searches / filters any object or function and returns matched properties.
/*
Grep.js
Author : Nic da Costa ( @nic_daCosta )
Created : 2012/11/14
Version : 0.2
(c) Nic da Costa
License : MIT, GPL licenses
Overview:
Basic function that searches / filters any object or function and returns matched properties.