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
// Suppose we have a CSS element with a SVG into the content property | |
// .class:before { | |
// content: url('imagen.svg'); | |
// } | |
// | |
// This script replaces the SVG in the CSS for the inline CSS so you can access via JS or CSS later | |
jQuery(document).ready(function() { | |
var replaceWithSVG = function(selector, url) { | |
jQuery('').appendTo('head'); | |
// Gets the SVG file |
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 PROCEDURE geodist (IN mylat decimal(18,12), IN mylon decimal(18,12), IN dist float) | |
BEGIN | |
declare lon1 float; | |
declare lon2 float; | |
declare lat1 float; | |
declare lat2 float; | |
set lon1 = mylon-dist/abs(cos(radians(mylat))*69); | |
set lon2 = mylon+dist/abs(cos(radians(mylat))*69); | |
set lat1 = mylat-(dist/69); | |
set lat2 = mylat+(dist/69); |
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
// https://codepen.io/luissacristan/pen/vxmKoP | |
document.querySelectorAll( 'div' ).forEach( elem => { | |
elem.outerHTML = '<div>' + elem.outerHTML + '</div>'; | |
}); |
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
// Not valid for IE8 or older (I don't mind) | |
document.addEventListener("DOMContentLoaded", () => { | |
// Some code | |
}); |
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
var parent = document.getElementById('myid').parentNode |
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
var elem = document.getElementById('myid'); | |
var w = window.getComputedStyle(elem).width; |
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
grep 'error_log\|console' $(git status -s | sed 's/^\s//' | cut -d " " -f2) |
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 regex = /[\w_-]+=(['"])((?!\1).)+\1/gu; | |
`<div data-slogan="Don't do it" data-warning='Use double quotes (")'>`.match( regex) |
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 i in $(git status -s | sed 's/^\s//' | cut -d " " -f2 | grep '.php'); do ./vendor/bin/phpcs "$i"; done |
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
<?php | |
for ( $i = 0; $i<10; $i++) { | |
$width = rand(600, 1200); | |
$height = rand(600, 1200); | |
file_put_contents( uniqid(rand(), true) . '.jpg', file_get_contents( 'https://picsum.photos/'.$width.'/'.$height)); | |
sleep(2); | |
} |
OlderNewer