Skip to content

Instantly share code, notes, and snippets.

View Fahrek's full-sized avatar

Andres G. Quina Fahrek

View GitHub Profile
@moisessepulveda
moisessepulveda / paginator.html
Last active July 14, 2024 02:15
DJANGO BOOTSTRAP PAGINATOR
{% if paginator.num_pages > 1%}
<div class="d-flex justify-content-center">
<ul class="pagination">
{% if entity.has_previous %}
<li class="page-item d-none d-sm-block"><a class="page-link" href="?page={{ entity.previous_page_number }}#pagtable">Anterior</a></li>
{% endif %}
{% for page in paginator.page_range %}
{% if forloop.last and page != entity.number and paginator.num_pages > 7 %}
{% if entity.next_page_number != paginator.num_pages%}
<li class="page-item">
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);
});
}
@seoagentur-hamburg
seoagentur-hamburg / .htaccess
Last active March 25, 2025 06:45
UPDATE 2024/03: 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 2.0.9 - 03/2024
# ----------------------------------------------------------------------
# @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
########################################################################
@aggarwalankush
aggarwalankush / city.list.json
Created November 5, 2016 13:39
openweathermap city list
[{"_id":2610888,"name":"Understed","country":"DK","coord":{"lon":10.51667,"lat":57.383331}},
{"_id":2613685,"name":"Skodsborg","country":"DK","coord":{"lon":12.57324,"lat":55.822498}},
{"_id":2613357,"name":"Smidstrup","country":"DK","coord":{"lon":12.55787,"lat":55.865688}},
{"_id":6460975,"name":"Rastnik","country":"BG","coord":{"lon":25.283331,"lat":41.400002}},
{"_id":727762,"name":"Rastnik","country":"BG","coord":{"lon":25.283331,"lat":41.400002}},
{"_id":596826,"name":"Murava","country":"LT","coord":{"lon":23.966669,"lat":54.916672}}]
@zma
zma / rss2html.php
Last active September 12, 2023 16:36
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
*/
@lsjroberts
lsjroberts / gulpfile.js
Last active February 15, 2025 10:50
Gulp styles & scripts build and watcher
/**
* Install:
* $ npm install gulp gulp-minify-css gulp-autoprefixer gulp-ruby-sass gulp-coffee gulp-uglify gulp-concat gulp-rimraf gulp-notify
*/
var gulp = require('gulp');
// styles
var minifycss = require('gulp-minify-css');
var autoprefixer = require('gulp-autoprefixer');
@josephilipraja
josephilipraja / countries.php
Last active April 17, 2024 05:42
List of Countries with Country code & Telephone (Dial) Code as a PHP Array. Bonus: PHP function to list all Countries as HTML Select Tag Options with their 2 character Country code as values
<?php
$countryArray = array(
'AD'=>array('name'=>'ANDORRA','code'=>'376'),
'AE'=>array('name'=>'UNITED ARAB EMIRATES','code'=>'971'),
'AF'=>array('name'=>'AFGHANISTAN','code'=>'93'),
'AG'=>array('name'=>'ANTIGUA AND BARBUDA','code'=>'1268'),
'AI'=>array('name'=>'ANGUILLA','code'=>'1264'),
'AL'=>array('name'=>'ALBANIA','code'=>'355'),
'AM'=>array('name'=>'ARMENIA','code'=>'374'),
'AN'=>array('name'=>'NETHERLANDS ANTILLES','code'=>'599'),
@prime31
prime31 / gist:5675017
Last active September 9, 2024 04:24
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
@internoma
internoma / README.mdown
Created May 20, 2013 18:53
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

@betweenbrain
betweenbrain / gist:5405671
Created April 17, 2013 16:26
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,