View serial_number_generator.js
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
let count = 10100; | |
let prefix = "KGY" | |
let keys = []; | |
let getRandomNumber = () => ("0000" + Math.round(Math.random() * 10000)).slice(-4) | |
do { | |
let randomKey = prefix + "-" + getRandomNumber() + "-" + getRandomNumber(); | |
if (keys.indexOf(randomKey) === -1) { |
View filtered_contact_type.patch
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
--- web/app/plugins/civicrm/civicrm/CRM/Profile/Selector/Listings.php | |
+++ Listings.php | |
@@ -451,6 +451,8 @@ | |
$additionalWhereClause = 'contact_a.is_deleted = 0'; | |
+ $extraWhereClause = 'contact_a.contact_type = "Organization" AND contact_a.id != 1'; | |
+ | |
if ($extraWhereClause) { | |
$additionalWhereClause .= " AND {$extraWhereClause}"; |
View mailtrain_scrapper.js
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 rows = []; | |
$('tbody tr').each((i, elem) => { | |
var $elem = $(elem), | |
$td = $(elem).find('td'); | |
var row = []; | |
row.push($td[0].innerText); | |
row.push($td[1].innerText); | |
row.push($td[2].innerText); |
View shortcode_parse.js
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 shortcode = '[hello name="world"]'; | |
var attributes = {}; | |
shortcode.match(/[\w-]+=".+?"/g).forEach(function(attribute) { | |
attribute = attribute.match(/([\w-]+)="(.+?)"/); | |
attributes[attribute[1]] = attribute[2]; | |
}); | |
console.log(attributes); |
View restart-touchbarserver.sh
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
sudo pkill TouchBarServer; sudo killall ControlStrip |
View realname.diff
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
diff --git a/realname.api.php b/realname.api.php | |
index 09e813e..d5420bd 100644 | |
--- a/realname.api.php | |
+++ b/realname.api.php | |
@@ -53,6 +53,17 @@ function hook_realname_update($realname, $account) { | |
} | |
+/** | |
+ * Respond to updates to accounts |
View acf-pagination.php
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 | |
/* | |
* Paginate Advanced Custom Field repeater | |
*/ | |
if( get_query_var('page') ) { | |
$page = get_query_var( 'page' ); | |
} else { | |
$page = 1; | |
} |
View bootstrap-grid-col-same-height.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
.row { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
flex-wrap: wrap; | |
} | |
.row > [class*='col-'] { | |
display: flex; | |
flex-direction: column; |
View .my.cnf
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
[mysql] | |
user=backups | |
password=secret | |
[mysqldump] | |
user=backups | |
password=secret |
View wp_relative_url.php
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 callback_relative_url($buffer) { | |
// Replace normal URLs | |
$home_url = esc_url(home_url('/')); | |
$home_url_relative = wp_make_link_relative($home_url); | |
// Replace URLs in inline scripts | |
$home_url_escaped = str_replace('/', '\/', $home_url); | |
$home_url_escaped_relative = str_replace('/', '\/', $home_url_relative); | |
$buffer = str_replace($home_url, $home_url_relative, $buffer); |
NewerOlder