How to add Live Template in Webstorm
- open preferences
- editor> live templates
- add template group for React Native
- add templates below to the new group
- define context > javascript
- edit variables > add "fileNameWithoutExtension" to "$fnName$"
<?php | |
/** | |
* Plugin Name: Search Canonical Push for Google Analytics | |
* Plugin URI: https://theseoframework.com/ | |
* Description: This plugin adds a small script to Search archives that optimizes the Google Analytics script when using pretty Search links. | |
* Version: 1.0.1 | |
* Author: Sybre Waaijer | |
* Author URI: https://theseoframework.com/ | |
* License: GPLv3 | |
*/ |
ffmpeg -i huge-file.mp4 -vcodec libx264 -preset veryfast smaller-file.mp4 |
import R from 'ramda'; | |
const items = [ | |
{id: 1, name: 'Al', country: 'AA'}, | |
{id: 2, name: 'Connie', country: 'BB'}, | |
{id: 3, name: 'Doug', country: 'CC'}, | |
{id: 4, name: 'Zen', country: 'BB'}, | |
{id: 5, name: 'DatGGboi', country: 'AA'}, | |
{id: 6, name: 'Connie', country: 'AA'}, | |
]; |
const toClassString = (obj) => Object.keys(obj).filter((key) => obj[key]===true).join(' ').trim() |
const formatNumber = (num, delimiter = ',') => num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, delimiter) |
/** | |
* Returns a hash code for a string. | |
* (Compatible to Java's String.hashCode()) | |
* | |
* The hash code for a string object is computed as | |
* s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] | |
* using number arithmetic, where s[i] is the i th character | |
* of the given string, n is the length of the string, | |
* and ^ indicates exponentiation. | |
* (The hash value of the empty string is zero.) |
I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.
I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.
Chrome 51 has some pretty wild behaviour related to console.log
in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.
hbspt.forms.create({ | |
... | |
onFormReady: function($form, ctx) { | |
$form.submit(function(){ | |
//synchronous delay | |
HSPopup.pause(300); | |
//Your code goes here |
const hasTouchscreen = () => { | |
const mobileDevice = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) | |
const onTouchEnd = ('ontouchend' in document.documentElement) | |
return (mobileDevice && onTouchEnd) | |
} |