View snippets.code-snippets
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
Show hidden characters
{ | |
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | |
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | |
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | |
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | |
// Placeholders with the same ids are connected. | |
// Example: | |
// "Print to console": { | |
// "scope": "javascript,typescript", |
View ffmpeg-compress-mp4
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
ffmpeg -i input.mp4 -codec:v libx264 -preset slow -b:v 1000k -maxrate 1500k -bufsize 1500k -vf scale=1080:-1 -threads 0 -codec:a libfdk_aac -b:a 128k output.mp4 |
View findAndReplace.js
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
const fs = require('fs'); | |
const signale = require('signale'); | |
module.exports = (filePath, regex, replacement) => | |
new Promise((yep, nope) => { | |
fs.readFile(filePath, 'utf8', (err, data) => { | |
if (err) { | |
console.log(err); // eslint-disable-line | |
nope(err); | |
} |
View EditUserProfile.js
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
// @flow | |
import React, { useState } from 'react'; | |
import { KeyboardAvoidingView, ScrollView, Text, View } from 'react-native'; | |
import { Header } from '../../components/Header'; | |
import { Button } from '../../components/Button'; | |
import { ProfileImage } from '../../components/ProfileImage'; | |
import PostInput from '../../components/PostInput'; | |
import PostBody from '../../components/PostBody'; |
View handle-input-change.js
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
handleChange = e => { | |
const {name, value} = e.currentTarget | |
this.setState({ | |
[name]: value | |
}) | |
} | |
// Make sure you've set a 'name' attribute on the input. |
View main.code-snippets
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
{ | |
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | |
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | |
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | |
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | |
// Placeholders with the same ids are connected. | |
// Example: | |
// "Print to console": { | |
// "scope": "javascript,typescript", |
View ffmpeg-resize-convert-compress-all.sh
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
for file in *.mp4; do ffmpeg -i "$file" -filter:v scale=1080:-1 -acodec libvorbis -ac 2 -b:v 5000k "${file%.mp4}".webm; done |
View split.js
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
function split(string) { | |
return string.match(/\w+(?:\s\w+)*\W?/g) | |
} | |
console.log(split("string one, string two, thing three, four four.")) | |
// ["string one,", "string two,", "thing three,", "four four."] | |
// https://regex101.com/r/1mn4J9/1/ |
View compress-images.sh
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
convert -strip -interlace Plane -sampling-factor 4:2:0 -quality 85% part-1.jpg result.jpg |
NewerOlder