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
/* | |
* Ex: | |
* include("http://mysite.com/bookmarklet.css"); | |
* include("http://mysite.com/bookmarklet.js"); | |
*/ | |
let include = ( src, callback ) => { | |
let ext = src.split( /[\#\?]/ )[ 0 ].split( '.' ).pop().toLowerCase(); | |
let inc; | |
if ( ext === 'css' ) { |
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
### User template | |
# Folders | |
bower_components/ | |
.project | |
.nuxt | |
# Compiled source | |
*.class | |
*.com | |
*.dll |
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
/** | |
* Carregamento condicional de css/img conforme a resolução. | |
* | |
* Através de data-*, permite que somente as folhas de estilos (e, | |
* opcionalmente, imagens) que batem com determinada resolução sejam | |
* carregados e entrem em ação. | |
* | |
* Deve-se usar seguindo o modelo: | |
* <link rel="stylesheet" | |
* class="mediaquerydependent" |
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
// | |
// By default, WordPress comes with a handy search but it only search in post | |
// titles and contents. If you are working on a custom post type, you most | |
// probably using custom fields to store its attributes. For example, A | |
// Property custom post type would have address, city and state custom fields. | |
// You may have used WP_Query object with meta_query setup, But, it does not | |
// work. If you do not use “s” attribute, it will overwrite the default search | |
// and If you use it, it will not return the expected results. This snippet will | |
// use posts_clauses filter to inject the meta query that will combine with the | |
// WordPress’s default search parameter. |
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
# MAINTENANCE-PAGE REDIRECT | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{REMOTE_ADDR} !^123.456.789.000 # whatismyip.com | |
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC] | |
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC] | |
RewriteRule .* /maintenance.html [R=302,L] | |
</IfModule> |
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
Create a new repository on the command line | |
------------------------------------------- | |
touch README.md | |
git init | |
git add README.md | |
git commit -m "first commit" | |
git remote add origin [SSH GIT ADDRESS] | |
git push -u origin master |
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 emailEncode($e) | |
{ | |
$email_len = strlen($e); | |
for ($i = 0; $i < $email_len; $i++) { | |
$output .= '&#'.ord($e[$i]).';'; | |
} | |
return $output; | |
} |
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
// | |
// Returns first element that matches CSS selector {expr}. | |
// Querying can optionally be restricted to {container}’s descendants | |
// | |
function $( expr, container ) { | |
return typeof expr === 'string' ? ( container || document ).querySelector( expr ) : expr || null; | |
} | |
// |
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 slugify(text) { | |
return text.toString().toLowerCase().trim() | |
.normalize('NFD') // separate accent from letter | |
.replace(/[\u0300-\u036f]/g, '') // remove all separated accents | |
.replace(/\s+/g, '-') // replace spaces with - | |
.replace(/&/g, '-and-') // replace & with 'and' | |
.replace(/[^\w\-]+/g, '') // remove all non-word chars | |
.replace(/\-\-+/g, '-') // replace multiple '-' with single '-' | |
} |
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
/* Headers out of order (i.e. h2 before h1 etc.) | |
Result: dotted blue outline | |
@see https://twitter.com/Una/status/1277652897606635523 | |
*/ | |
h2 ~ h1, | |
h3 ~ h1, | |
h4 ~ h1, | |
h5 ~ h1, | |
h6 ~ h1, | |
h3 ~ h2, |
OlderNewer