Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Looking for my next project...

Guy Vider TravelingTechGuy

💭
Looking for my next project...
View GitHub Profile
@twmbx
twmbx / vanilla-ajax-poll.js
Last active Aug 20, 2020
Polling in JS with an async ajax call that returns a promise ( modified from: https://davidwalsh.name/javascript-polling )
View vanilla-ajax-poll.js
// 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!
@TravelingTechGuy
TravelingTechGuy / sortedObjectPropertiesCaseInsensitive
Last active Jan 1, 2016
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)
View sortedObjectPropertiesCaseInsensitive
//0. given:
var _ = require('lodash');
var items = [
{
name: 'dfsdfd',
value: null
},
{
name: 'Abc',
value: null,
@MarcDiethelm
MarcDiethelm / Contributing.md
Last active Oct 22, 2020
How to contribute to a project on Github
View Contributing.md

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.

@shanselman
shanselman / gist:5422230
Last active Oct 22, 2020
Evil Blog Comment Spammer just exposed his template through some error and the whole thing showed up in my comments.
View gist:5422230
{
{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.|
@raphaelstolt
raphaelstolt / php54_php53_pear_macports.markdown
Created May 17, 2012
Installing PHP 5.4 and 5.3 side by side on Max OSX via MacPorts
View php54_php53_pear_macports.markdown

##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

View server.js
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) {
View ios-8-web-app.html
<!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 Aug 18, 2020
*[data-markdown] - use markdown, sometimes, in your HTML
View data-markdown.user.js
// ==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.
@naholyr
naholyr / app.js
Created Aug 27, 2011
REST avec NodeJS & Express - Application
View app.js
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 () {
You can’t perform that action at this time.