Skip to content

Instantly share code, notes, and snippets.

View saqueib's full-sized avatar

Mohd Saqueib Ansari saqueib

View GitHub Profile
@kissarat
kissarat / remove-php-storm-2017.sh
Last active April 27, 2017 06:53 — forked from istepanov/gist:3950977
Remove PHPStorm settings from macOS 10.12.1 Sierra
#!/usr/bin/sh
rm -rf $HOME/Library/Preferences//PhpStorm201*
rm -rf $HOME/Library/Caches/PhpStorm201*
rm -rf $HOME/Library/Application\ Support/PhpStorm201*
rm -rf $HOME/Library/Logs/PhpStorm201*
@OllieJones
OllieJones / fullquery
Last active September 25, 2023 14:09
Fast nearest-location finder for SQL (MySQL, PostgreSQL, SQL Server)
SELECT zip, primary_city,
latitude, longitude, distance
FROM (
SELECT z.zip,
z.primary_city,
z.latitude, z.longitude,
p.radius,
p.distance_unit
* DEGREES(ACOS(LEAST(1.0, COS(RADIANS(p.latpoint))
* COS(RADIANS(z.latitude))
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}