Skip to content

Instantly share code, notes, and snippets.

@Anexo
Anexo / Shapefile-jsonAngular8.js
Last active November 1, 2023 15:24
Shapefile-js on Angular 8
/*
Hi all,
For those of you, using the amazing package shapefile-js written by calvinmetcalf: https://github.com/calvinmetcalf/shapefile-js/
Here is a brief decription, on how to make it work on Angular 8:
First install the package with:
npm install shpjs --save
@Anexo
Anexo / phpWordCountWords.php
Last active November 19, 2020 11:36
Read in a docx, save into variable and count the words. Word 2007 format only.
<?php
require 'vendor/autoload.php';
$source = 'example.docx';
$phpword = \PhpOffice\PhpWord\IOFactory::load($source);
$sections = $phpword->getSections();
@Anexo
Anexo / gist:b09d3207489280c41789
Last active August 29, 2015 14:06
Friendly URLs in Rails with Latin or Special Charachters

Friendly URLs in Rails with Latin or Special Characters:

Based on the Gist by: jcasimir -> https://gist.github.com/jcasimir/1209730#friendly-urls !!

By default, Rails app's build URL based on the primary key (the id) column of the database.

Imagine we have a User model and associated controller. Our first User is called John Doe and has an id = 1. The Url of his user page would be:

/user/1