Skip to content

Instantly share code, notes, and snippets.

View Fahrek's full-sized avatar

Andres G. Quina Fahrek

View GitHub Profile
@Fahrek
Fahrek / phonePrefixCodesWithCountry.php
Created March 19, 2019 10:22 — forked from grexlort/phonePrefixCodesWithCountry.php
List of phone prefix codes with country in PHP array format prefix => country +xxx
// data from https://gist.github.com/andyj/7108917
$array = [
'44' => 'UK (+44)',
'1' => 'USA (+1)',
'213' => 'Algeria (+213)',
'376' => 'Andorra (+376)',
'244' => 'Angola (+244)',
'1264' => 'Anguilla (+1264)',
'1268' => 'Antigua & Barbuda (+1268)',
function print() {
const filename = 'ThisIsYourPDFFilename.pdf';
html2canvas(document.querySelector('#nodeToRenderAsPDF')).then(canvas => {
let pdf = new jsPDF('p', 'mm', 'a4');
pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 0, 0, 211, 298);
pdf.save(filename);
});
}
@Fahrek
Fahrek / fill-form-with-voice.markdown
Created April 29, 2019 17:55
Fill Form with voice
@Fahrek
Fahrek / gist:8bf0c1eb39c36d0a27603bdf1d274e20
Created August 4, 2019 07:59 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@Fahrek
Fahrek / gist:7d1155ab3390abfb2be5c1c97d1ff51d
Created August 20, 2019 14:22 — forked from betweenbrain/gist:5405671
Use cURL and SimpleXML to retrieve and parse Wordpress RSS feed
<?php
$curl = curl_init();
curl_setopt_array($curl, Array(
CURLOPT_URL => 'http://blogs.guggenheim.org/map/feed/',
CURLOPT_USERAGENT => 'spider',
CURLOPT_TIMEOUT => 120,
CURLOPT_CONNECTTIMEOUT => 30,
CURLOPT_RETURNTRANSFER => TRUE,
@Fahrek
Fahrek / rss2html.php
Created August 21, 2019 15:13 — forked from zma/rss2html.php
rss2html.php
<?php
// Check http://www.systutorials.com/136102/a-php-function-for-fetching-rss-feed-and-outputing-feed-items-as-html/ for description
// RSS to HTML
/*
$tiem_cnt: max number of feed items to be displayed
$max_words: max number of words (not real words, HTML words)
if <= 0: no limitation, if > 0 display at most $max_words words
*/
/* USAGE:
$(function(){
var steps = new Stepper("#steps");
steps.addSlide(1, function(){ this.canvas.text("slide 1"); });
steps.addSlide(2, function(){ this.canvas.text("slide 2"); });
steps.go();
});
*/
@Fahrek
Fahrek / gist:bb976ae77d65c80cd9027656c625a224
Created October 14, 2019 01:36 — forked from webaware/gist:4048580
basic example of populating a form from a database using AJAX and JSON, jQuery version
<?php
// jQuery version of https://gist.github.com/3110728
/*
-- the SQL database table
create table form_ajax (
ID varchar(5) not null,
Name varchar(100),
Address varchar(100),
@Fahrek
Fahrek / README.mdown
Created October 15, 2019 06:42 — forked from internoma/README.mdown
Leer JSON y rellenar control form select

Lee un archivo json y añade la lista de opciones a un elemento select

Reading json file and append list options into element select

@Fahrek
Fahrek / .htaccess
Created March 23, 2020 03:09 — forked from seoagentur-hamburg/.htaccess
UPDATE 2019/07: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2020
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################