Skip to content

Instantly share code, notes, and snippets.

@jgthms
jgthms / mo.js
Created November 27, 2016 16:48
const shiftCurve = mojs.easing.path( 'M0,100 C50,100 50,100 50,50 C50,0 50,0 100,0' );
const scaleCurveBase = mojs.easing.path( 'M0,100 C21.3776817,95.8051376 50,77.3262711 50,-700 C50,80.1708527 76.6222458,93.9449005 100,100' );
const scaleCurve = (p) => { return 1 + scaleCurveBase(p); };
const nScaleCurve = (p) => { return 1 - scaleCurveBase(p)/10; };
const circle = new mojs.Shape({
shape: 'rect',
fill: { '#F64040' : '#F64040', curve: scaleCurve },
radius: 10,
rx: 3,
background-color: #21D4FD;
background-image: linear-gradient(135deg, #21D4FD 0%, #B721FF 50%, #ff8787 100%);
:root {
--sizeBody: 16px; /* 1rem = 16px */
--navHeight: 4rem; /* 4 * 16px = 64px */
}
.nav {
height: var(--navHeight);
}
@media (min-width: 1000px) {
@jgthms
jgthms / clickdrag.swift
Created December 7, 2017 11:25
Click drag mouse to specific position and dimension via command line in Mac OS
#!/usr/bin/env xcrun swift
import Foundation
let firstDelayUSec : useconds_t = 2000_000
let kDelayUSec : useconds_t = 500_000
func DragMouse(from p0: CGPoint, to p1: CGPoint) {
let mouseDown = CGEvent.init(mouseEventSource:nil, mouseType:.leftMouseDown, mouseCursorPosition:p0, mouseButton:.left)!
let mouseDrag = CGEvent.init(mouseEventSource:nil, mouseType:.leftMouseDragged, mouseCursorPosition:p1, mouseButton:.left)!
let mouseUp = CGEvent.init(mouseEventSource:nil, mouseType:.leftMouseUp, mouseCursorPosition:p1, mouseButton:.left)!
@jgthms
jgthms / js-fiddle-hljs.css
Created December 20, 2017 20:43
JSFiddle syntax highlighting colors for highlight js (hljs)
.hljs {
display: block;
overflow-x: auto;
color: #000;
background-color: transparent;
padding: 0;
margin: 0;
-webkit-text-size-adjust: none;
}
@jgthms
jgthms / srt.tcl
Created December 27, 2017 09:16 — forked from antirez/srt.tcl
stretch / sync an SRT subtitle file to exactly match your video file.
# Quick hack to stretch the .srt subtitles to match the one of your video.
# Check the time of the first and last sentence in your video file, then
# use this tool to convert the .srt file into one matching your video with:
#
# tclsh srt.tcl file.srt <your start time> <your end time> > output.srt
#
# Example:
#
# tclsh srt.tcl my.srt 00:00:24,000 00:44:15,000 > ~/Desktop/new.srt
#
@jgthms
jgthms / apple-shadow.css
Created March 12, 2018 20:28
Apple shadow
.apple {
box-shadow: 0 37.125px 70px -12.125px rgba(0,0,0,0.3);
}
@jgthms
jgthms / pure_html_css_modal.css
Created June 12, 2019 17:22 — forked from calebporzio/pure_html_css_modal.css
The CSS for the pure HTML/CSS modal I tweeted about.
details summary {
cursor: pointer;
outline: none !important;
display: inline-block;
padding: 8px 12px;
padding-top: 10px;
border-radius: 4px;
overflow: hidden;
background: #F09825;
color: white;
@jgthms
jgthms / git-deployment.md
Created October 27, 2019 17:27 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

// How to persist the React Redux state store to the browser's localStorage
// Code taken from Dan Abramov's video
// https://egghead.io/lessons/javascript-redux-persisting-the-state-to-the-local-storage
/**
localStorage.js
*/
export const loadState = () => {
try {
const serializedState = localStorage.getItem('state');