Skip to content

Instantly share code, notes, and snippets.

💻
Working hard!

Jamie Shields jayshields

💻
Working hard!
Block or report user

Report or block jayshields

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jayshields
jayshields / mysql-blank-root-password.sh
Last active Jul 26, 2018
MySQL 5.7.22 on Ubuntu 18.04 set root password to blank (for local dev only!)
View mysql-blank-root-password.sh
sudo /etc/init.d/mysql stop
sudo mkdir /var/run/mysqld/
sudo chown mysql /var/run/mysqld/
sudo mysqld_safe --skip-grant-tables &
mysql -u root
use mysql;
update user set authentication_string = PASSWORD(""), plugin = "mysql_native_password" where User='root';
flush privileges;
quit;
sudo /etc/init.d/mysql stop
@jayshields
jayshields / ac_invoices_total_bookmarklet.js
Created Sep 28, 2016
Active Collab invoice total bookmarklet
View ac_invoices_total_bookmarklet.js
$('[ng-repeat="invoices in grouped_invoices"]').each(function(){
var total = 0;
$(this).find('.invoice_card_amount_number').each(function(){
total += parseInt($(this).text().replace(',','').replace('.00',''));
});
$(this).find('h2.lighter').text($(this).find('h2.lighter').text()+''+total+')');
});
@jayshields
jayshields / whitelist_access_origin.php
Created Aug 11, 2016
Access-Control-Allow-Origin whitelist for Silex
View whitelist_access_origin.php
$app->after(function(Request $request, Response $response){
$access_whitelist = array('https://domain1.com', 'https://domain2.com', 'https://domain3.com');
if(in_array($_SERVER['HTTP_ORIGIN'], $access_whitelist))
$response->headers->set('Access-Control-Allow-Origin', $_SERVER['HTTP_ORIGIN']);
});
@jayshields
jayshields / index.php
Created Nov 24, 2015
Dropbox API output images from directory
View index.php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.dropboxapi.com/2/files/list_folder');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer MY_DROPBOX_ACCESS_KEY',
'Content-Type: application/json',
'Accept: application/json'
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@jayshields
jayshields / script.js
Last active Nov 7, 2015
NatWest online banking print statement fix
View script.js
document.getElementById('ctl00_secframe').contentWindow.print();
You can’t perform that action at this time.