List of helpful shortcuts for faster coding
If you have any other helpful shortcuts, feel free to add in the comments of this gist :)
import useScrollRestoration from "utils/hooks/useScrollRestoration"; | |
const App = ({ Component, pageProps, router }) => { | |
useScrollRestoration(router); | |
return <Component {...pageProps} />; | |
}; | |
export default App; |
import piexif | |
def set_desc(imgPath, message): | |
exif_dict = piexif.load(imgPath) | |
exif_dict['0th'][40092] = string_to_array(message) | |
exif_bytes = piexif.dump(exif_dict) | |
piexif.insert(exif_bytes, imgPath) | |
return 1 | |
def string_to_array(string): |
<?php | |
/** | |
* Supply a user id and an access token | |
* Jelled explains how to obtain a user id and access token in the link provided | |
* @link http://jelled.com/instagram/access-token | |
*/ | |
$userid = ""; | |
$accessToken = ""; | |
// Get our data | |
function fetchData($url){ |
Windows Service with Python 3.5 and pyinstaller
// ==UserScript== | |
// @name Steam Queue Auto Discoverer | |
// @description Discover the Steam queue three times to get the sale cards | |
// @version 2.3.0 | |
// @namespace https://gist.github.com/xPaw/73f8ae2031b4e528abf7 | |
// @icon https://store.steampowered.com/favicon.ico | |
// @match https://store.steampowered.com/explore* | |
// @grant none | |
// ==/UserScript== |
// For Yoast SEO Plugin Version: 14.1+ add to your Wordpress Theme's functions.php... | |
// Remove All Yoast HTML Comments | |
// https://gist.github.com/paulcollett/4c81c4f6eb85334ba076 | |
// Credit @devendrabhandari (https://gist.github.com/paulcollett/4c81c4f6eb85334ba076#gistcomment-3303423) | |
add_filter( 'wpseo_debug_markers', '__return_false' ); | |
// For Yoast SEO Plugin Version: < 14.1 add to your Wordpress Theme's functions.php... |
#Resizes an image and keeps aspect ratio. Set mywidth to the desired with in pixels. | |
import PIL | |
from PIL import Image | |
mywidth = 300 | |
img = Image.open('someimage.jpg') | |
wpercent = (mywidth/float(img.size[0])) | |
hsize = int((float(img.size[1])*float(wpercent))) |
<?php | |
/** | |
* Delete a user meta transient. | |
*/ | |
function delete_user_meta_transient( $user_id, $transient ) { | |
global $_wp_using_ext_object_cache; | |
$user_id = (int) $user_id; | |
do_action( 'delete_user_meta_transient_' . $transient, $user_id, $transient ); |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000