Alias | Command |
---|---|
g | git |
ga | git add |
gaa | git add --all |
gapa | git add --patch |
gb | git branch |
This file contains hidden or 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
--- | |
METHOD 1 | |
This should roughly sort the items on distance in MySQL, and should work in SQLite. | |
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance. | |
--- | |
SELECT * | |
FROM table | |
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC |
This file contains hidden or 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
const hexToAscii = str => { | |
return str | |
.match(/.{2}/g) | |
.reduce( | |
(current, substr) => current + String.fromCharCode(parseInt(substr, 16)), | |
'', | |
) | |
.replaceAll(/\x00|\\b|\n|\r/g, ''); // remove unwanted characters | |
}; |
This file contains hidden or 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
FROM php:7.2-fpm-alpine | |
# docker-entrypoint.sh dependencies | |
RUN apk add --no-cache \ | |
# in theory, docker-entrypoint.sh is POSIX-compliant, but priority is a working, consistent image | |
bash \ | |
# BusyBox sed is not sufficient for some of our sed expressions | |
sed | |
# install the PHP extensions we need |
This file contains hidden or 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
ffmpeg \ | |
-f lavfi \ | |
-i anullsrc \ | |
-rtsp_transport tcp \ | |
-i $INPUT \ | |
-tune zerolatency \ | |
-vcodec libx264 \ | |
-t 12:00:00 \ | |
-pix_fmt + \ | |
-c:v copy \ |
This file contains hidden or 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
/* | |
===== store.js ===== | |
import createStore from '@store' | |
const initialState = { foo: 'bar' } | |
export const { Provider, connect } = createStore(initialState) | |
===== parent.js ===== | |
import {Provider} from './store' | |
const Parent = () => { | |
return ( |
This file contains hidden or 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
# get XCode Commandline path | |
xcode-select --print-path | |
# usually will output /Library/Developer/CommandLineTools | |
sudo rm -rf (what ever the output of above) | |
#install it back | |
xcode-select --install |
This file contains hidden or 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
/* | |
How to use: | |
<ImageInput | |
width={200} // required, width of the image component | |
height={200} // required, height of the image compoent | |
image='' // initial image value | |
onUpdate={(image) => { console.log(image) } } // do something the the image string in base64 | |
onUpdating={() => { console.log('component is currently being updated') }} | |
onUpdated={() => { console.log('component is currently has been updated') }} /> | |
*/ |
This file contains hidden or 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
/* Source: https://codepen.io/mckenziedave/ */ | |
* {margin: 0; padding: 0;font-size: 16px!important;} | |
.tree ul { | |
padding-top: 20px; position: relative; | |
transition: all 0.5s; | |
-webkit-transition: all 0.5s; | |
-moz-transition: all 0.5s; | |
} |
This file contains hidden or 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
/* | |
* http://www.javascriptkit.com/dhtmltutors/sticky-hover-issue-solutions.shtml | |
* Method 3- Using CSS Media Queries Level 4 Interaction Media Features | |
*/ | |
@media (hover:none), | |
(hover:on-demand) { | |
nav a:hover { | |
/* suppress hover effect on devices that don't support hover fully */ | |
background: none; |
NewerOlder