This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html[data-theme='dark'] { | |
--text-color: #f0F0F0; | |
--background-body: #1C1C1C; | |
--other-var: #111111; | |
} | |
html[data-theme='light'] { | |
--text-color: #111111; | |
--background-body: #FAFAFA; | |
--other-var: #ffffff; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hooks/use-viewport.js | |
import { useState, useEffect } from 'react' | |
export const MOBILE = 'MOBILE' | |
export const TABLET = 'TABLET' | |
export const DESKTOP = 'DESKTOP' | |
const getDevice = width => { | |
if (width < 768) return MOBILE | |
else if (width < 992) return TABLET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hooks/use-clipboard-api.js | |
import { useState, useCallback } from 'react' | |
function useClipboardApi() { | |
const [content, setContent] = useState(null) | |
const askPermission = useCallback(async queryName => { | |
try { | |
const permissionStatus = await navigator.permissions.query(queryName) | |
return permissionStatus.state === 'granted' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hooks/use-page-visibility.js | |
import { useState, useLayoutEffect } from 'react' | |
function usePageVisibility() { | |
const [isPageVisible, setIsPageVisible] = useState(!document.hidden) | |
useLayoutEffect(() => { | |
const handleVisibility = () => { | |
setIsPageVisible(!document.hidden) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hooks/use-scroll.js | |
import { useEffect, useRef, useCallback, useState } from 'react' | |
function useScroll({ threshold = 450, isWindow = false, smooth = true } = {}) { | |
const [isAtBottom, setIsAtBottom] = useState(false) | |
const ref = useRef(isWindow ? window : null) | |
const goTop = useCallback(() => { | |
const element = ref.current | |
element.scrollTo({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- phpMyAdmin SQL Dump | |
-- version 3.5.2.2 | |
-- http://www.phpmyadmin.net | |
-- | |
-- Host: 127.0.0.1 | |
-- Generation Time: Apr 08, 2013 at 02:48 PM | |
-- Server version: 5.5.27 | |
-- PHP Version: 5.4.7 | |
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
let sleepTime="15*60"; | |
while [ 1 ] | |
do | |
if [ $(( $RANDOM % 2)) == 0 ] | |
then | |
echo "switching to NTWRK1"; | |
networksetup -setairportnetwork en1 {NTWRK_NAME} {NTWRK_PSWD} | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jekyll | |
class GooglePlusEmbedTag < Liquid::Tag | |
@post = nil | |
@height = '' | |
@width = '' | |
def initialize(tag_name, markup, tokens) | |
if markup =~ /(https:\/\/plus.google.com\/\d+\/posts\/\w+)/i | |
@url = $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# script: watch | |
# author: Mike Smullin <[email protected]> | |
# license: GPLv3 | |
# description: | |
# watches the given path for changes | |
# and executes a given command when changes occur | |
# usage: | |
# watch <path> <cmd...> | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get the absolute path of the folder where this script exists. | |
curr_dir=`pwd` | |
dir=`dirname $0` | |
FILE_PATH=`cd $dir;pwd` | |
# Install node | |
apt-get install python-software-properties curl -y | |
add-apt-repository ppa:chris-lea/node.js-devel |
NewerOlder