Skip to content

Instantly share code, notes, and snippets.

Avatar

Franco Gilio fgilio

View GitHub Profile
@fgilio
fgilio / concurrent-pool.php
Last active Aug 23, 2020 — forked from tonysm/concurrent-pool.php
Laravel HTTP client concurrent requests pool
View concurrent-pool.php
<?php
// 1. Register the routes
Route::get('test/{lorem}', function ($lorem) {
sleep(3);
return response()->json([
'message' => $lorem,
'token' => Str::random(),
]);
@fgilio
fgilio / mercadopago-payment-is-paid.php
Created Dec 11, 2018
MercadoPago check if a payment/merchant order is fully paid
View mercadopago-payment-is-paid.php
<?php
/*
* Keep in mind that this is heavily tied to the Laravel Framework
*
* $client_id
* $client_secret
* $externalReference
*/
MercadoPago\SDK::setClientId($client_id);
@fgilio
fgilio / axios-catch-error.js
Last active Sep 16, 2021
Catch request errors with Axios
View axios-catch-error.js
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@fgilio
fgilio / language-select-with-native-name.html
Created Feb 26, 2017
Language select with native names
View language-select-with-native-name.html
<form class="languages go" method="get" action="#">
<label for="language">Other languages:</label>
<select id="language" class="autosubmit" name="lang">
<option title="English (US)" value="en-US">
English (US) (en-US)
</option>
<option title="Afrikaans" value="af">
Afrikaans (af)
</option>
<option title="Arabic" value="ar">
View wpscan-tests.sh
// Directly executing ruby
wpscan.rb --url https://website.com --wordlist darkc0de.lst --username admin
ruby ./wpscan.rb --url https://website.com --wordlist darkc0de.lst --username admin
ruby ./wpscan.rb --url https://website.com
ruby ./wpscan.rb -u https://website.com --wordlist darkc0de.lst --username admin threads 50
ruby wpscan.rb --url https://website.com --wordlist passwords.txt threads 50
@fgilio
fgilio / remove-onclick.js
Created Sep 29, 2016
Remove onclick attribute from DOM element
View remove-onclick.js
document.getElementById('remove-onclick').removeAttribute("onclick");
View gitcheats.txt
# shortform git commands
alias g='git'
# get most modified files and counts
git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}' | sort -g
# Locally checkout all remote branches of a repository
git branch -r | cut -d '/' -f2 | grep -Ev '( |master)' | xargs -Ibranch git checkout -b branch origin/branch
# Open current Git repository URL
@fgilio
fgilio / wp-delete-transients.sql
Created Aug 16, 2016
WordPress - Deletes all Transients
View wp-delete-transients.sql
DELETE FROM `wp_options` WHERE `option_name` LIKE ('%\_transient\_%')
@fgilio
fgilio / wp_post_char_lenght_monthly.sql
Created Aug 2, 2016
WordPress average post character length for a given month
View wp_post_char_lenght_monthly.sql
SET @start = '2016-1-01';
SELECT AVG(CHAR_LENGTH(post_content)) AS avgLength
FROM wp_posts
WHERE post_type = 'post'
AND post_status = 'publish'
AND post_date >= @start
AND post_date < @start + INTERVAL 1 MONTH;