Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard.
This is the base javascript:
(function (text) {
var node = document.createElement('textarea')
var selection = document.getSelection()
<!-- Transparent GIF Image Favicon --> | |
<link rel="icon" href="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" type="image/gif"> | |
<!-- Black GIF Image Favicon --> | |
<link rel="icon" href="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=" type="image/gif"> | |
<!-- Transparent PNG Image Favicon --> | |
<link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=" type="image/png"> | |
<?php | |
/** | |
* Function to check for more than one | |
* array keys of a long/nested associative array. | |
* | |
* i.e, instead of doing this $var['key1']['key2'] (which will result in undefined | |
* notice if the key/index does not exist) you can do this isset_key($var, 'key1', 'key2') | |
* | |
* @param array $var Array variable |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Simple CSS Loading Icon</title> | |
</head> | |
<style type="text/css" media="screen"> | |
body { | |
margin-top: 150px; |
<?php | |
/** | |
* There is not a hard and fast rule to check if the | |
* current page is the blog page (the page you set in | |
* the settings to display blog posts). This is what the | |
* documentation says: "There is no conditional tag for the blog page." | |
* | |
* Read the full section here: https://codex.wordpress.org/Conditional_Tags | |
* | |
* Not sure if there is another way to achieve this! |
<?php | |
// This will break if the ENUM values have comma (,) in them | |
function get_enum_values($wpdb, $table, $field) { | |
$values = array(); | |
$table = "{$wpdb->prefix}{$table}"; | |
$query = "SHOW COLUMNS FROM {$table} WHERE Field = '{$field}'"; | |
$results = $wpdb->get_results($query, ARRAY_A); |
<?php | |
/** | |
* Break a string into | |
* n number of equal | |
* parts to an array | |
*/ | |
$string = 'This-is-a-long-string-that-has-some-random-text-with-hyphens!'; | |
$string_length = strlen($string); |
<?php | |
/** | |
* @author Ahmad Karim <hello@ahmadkarim.com> | |
* | |
* DEV & PROD specific variables | |
* for WordPress when working with | |
* LOCAL & LIVE instances at the same time | |
*/ | |
$localhosts = array('127.0.0.1', '::1'); |
<?php | |
class LocalValetDriver extends LaravelValetDriver { | |
/** | |
* Determine if the driver serves the request. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @param string $uri |