This is a recursive version of PHP's ksort function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var application_root = __dirname, | |
express = require("express"), | |
path = require("path"), | |
mongoose = require('mongoose'); | |
var app = express.createServer(); | |
// database | |
mongoose.connect('mongodb://localhost/ecomm_database'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts a string to a "URL-safe" slug. | |
* Allows for some customization with two optional parameters: | |
* | |
* @param {string} Delimiter used. If not specified, defaults to a dash "-" | |
* @param {array} Adds to the list of non-alphanumeric characters which | |
* will be converted to the delimiter. The default list includes: | |
* ['–', '—', '―', '~', '\\', '/', '|', '+', '\'', '‘', '’', ' '] | |
*/ | |
if (!String.prototype.slugify) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are a lot of complaints going around about Laravel these days, but a lot | |
of the important ones seem to be missing from the spotlight. | |
Bugfixes, issues and pull requests being left open for months with no | |
clarification of intent: | |
- https://github.com/laravel/framework/pull/1799 | |
- https://github.com/laravel/framework/issues/1963 | |
- https://github.com/laravel/framework/issues/2089 | |
- https://github.com/laravel/framework/issues/2234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from pocket import Pocket | |
import webbrowser, sys | |
# Get consumer key from cmd line | |
consumer_key = sys.argv[1] | |
request_token = Pocket.get_request_token( | |
consumer_key=consumer_key, |
OlderNewer