Skip to content

Instantly share code, notes, and snippets.

View phamngsinh's full-sized avatar

Pham Ng Sinh phamngsinh

View GitHub Profile
@phamngsinh
phamngsinh / gist:587e84c7bfb90e7f27984ca389e73830
Last active December 31, 2020 07:38
Find and Replace text in the entire table using a MySQL query
UPDATE table SET field = replace(field, text_needs_to_be_replaced, text_required);
https://smagic39.com
@phamngsinh
phamngsinh / golang tuts
Last active November 1, 2015 15:53 — forked from honkskillet/byte-sizetuts.md
A series of golang tutorials with youtube videos.
# byte-size tuts
by alexander white ©
## golang tutorials
- [0 - installation on a Mac](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-0---installation-on-a-mac)
- [1 - packages](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-1---packages)
- [2 - remote packages](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-2---remote-packages)
- [3 - variable syntax](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-3---variable-syntax)
- [4 - functions syntax](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-4---functions-syntax)
- [5 - loops syntax](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-5---loops-syntax)
@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
}
@damienalexandre
damienalexandre / tool.php
Created October 3, 2011 09:47
Download large file from the web via php
<?php
/**
* Download a large distant file to a local destination.
*
* This method is very memory efficient :-)
* The file can be huge, PHP doesn't load it in memory.
*
* /!\ Warning, the return value is always true, you must use === to test the response type too.
*
* @author dalexandre