Skip to content

Instantly share code, notes, and snippets.

View TravelingTechGuy's full-sized avatar
💭
Looking for my next project...

Guy Vider TravelingTechGuy

💭
Looking for my next project...
View GitHub Profile
var restify = require('restify');
var Logger = require('bunyan');
var log = new Logger({name: 'restifypretest'});
var server = restify.createServer({
name: 'restifypretest',
log: log
});
server.pre(function(req, res, next) {
@TravelingTechGuy
TravelingTechGuy / sortedObjectPropertiesCaseInsensitive
Last active January 1, 2016 20:59
Returns an array of one property from each item in a JSON array, sorted by name, regardless of case. This sample uses LoDash (can be used with Underscore)
//0. given:
var _ = require('lodash');
var items = [
{
name: 'dfsdfd',
value: null
},
{
name: 'Abc',
value: null,
@naholyr
naholyr / app.js
Created August 27, 2011 10:13
REST avec NodeJS & Express - Application
var express = require('express')
, app = module.exports = express.createServer()
app.configure(function () {
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(app.router);
app.use(express.static(__dirname + '/public'));
});
app.configure('development', function () {
@raphaelstolt
raphaelstolt / php54_php53_pear_macports.markdown
Created May 17, 2012 21:37
Installing PHP 5.4 and 5.3 side by side on Max OSX via MacPorts

##Given Apache 2 and MySQL are already installed.

#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated

#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules

@twmbx
twmbx / vanilla-ajax-poll.js
Last active February 6, 2023 14:57
Polling in JS with an async ajax call that returns a promise ( modified from: https://davidwalsh.name/javascript-polling )
// The polling function
function poll(fn, timeout, interval) {
var endTime = Number(new Date()) + (timeout || 2000);
interval = interval || 100;
var checkCondition = function(resolve, reject) {
var ajax = fn();
// dive into the ajax promise
ajax.then( function(response){
// If the condition is met, we're done!
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@paulirish
paulirish / data-markdown.user.js
Last active February 6, 2024 10:41
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
@shanselman
shanselman / gist:5422230
Last active March 28, 2024 10:33
Evil Blog Comment Spammer just exposed his template through some error and the whole thing showed up in my comments.
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|
@MarcDiethelm
MarcDiethelm / Contributing.md
Last active April 1, 2024 13:55
How to contribute to a project on Github

This text now lives at https://github.com/MarcDiethelm/contributing/blob/master/README.md. I turned it into a Github repo so you can, you know, contribute to it by making pull requests.


Contributing

If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.