This file contains hidden or 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
<target name="-tarball"> | |
<condition property="publish.exists"> | |
<available file="${dir.publish}" type="dir"/> | |
</condition> | |
<condition property="dist.exists"> | |
<available file="${dir.dist}" type="dir"/> | |
</condition> | |
<if> | |
<equals arg1="${publish.exists}" arg2="true"/> | |
<then> |
This file contains hidden or 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
# ---------------------------------------------------------------------- | |
# A little more security | |
# ---------------------------------------------------------------------- | |
# To avoid displaying the exact version number of Apache being used, add the | |
# following to httpd.conf (it will not work in .htaccess): | |
# ServerTokens Prod | |
# "-Indexes" will have Apache block users from browsing folders without a | |
# default document Usually you should leave this activated, because you |
This file contains hidden or 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
# ---------------------------------------------------------------------- | |
# Better website experience for IE users | |
# ---------------------------------------------------------------------- | |
# Force the latest IE version, in various cases when it may fall back to IE7 mode | |
# github.com/rails/rails/commit/123eb25#commitcomment-118920 | |
# Use ChromeFrame if it's installed for a better experience for the poor IE folk | |
<IfModule mod_headers.c> | |
Header set X-UA-Compatible "IE=Edge,chrome=1" |
This file contains hidden or 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
// https://github.com/bgrins/devtools-snippets | |
// Print out response headers for current URL | |
(function() { | |
var request=new XMLHttpRequest(); | |
request.open('HEAD',window.location,false); | |
request.send(null); | |
var headers = request.getAllResponseHeaders(); |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Product Shopping View Example</title> | |
<style> | |
/* | |
Original idea: | |
http://www.barrelny.com/blog/text-align-justify-and-rwd/ | |
http://codepen.io/patrickkunka/pen/GECBF | |
*/ |
This file contains hidden or 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 calculateDistance(lat1, lon1, lat2, lon2) { | |
var R = 6371; // km | |
var dLat = (lat2 - lat1).toRad(); | |
var dLon = (lon2 - lon1).toRad(); | |
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + | |
Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * | |
Math.sin(dLon / 2) * Math.sin(dLon / 2); | |
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | |
var d = R * c; | |
return d; |
This file contains hidden or 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
// simple implementation of a thread pool | |
function Pool(size) { | |
var _this = this; | |
// set some defaults | |
this.taskQueue = []; | |
this.workerQueue = []; | |
this.poolSize = size; | |
this.addWorkerTask = function(workerTask) { |
This file contains hidden or 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
'use strict'; | |
const Hapi = require('hapi'); | |
const Joi = require('joi'); | |
const server = new Hapi.Server(); | |
server.connection({ port: 8000 }); | |
// test by calling: | |
// http POST localhost:8000/user/123?id=456 | |
// or for validation failure testing, call: | |
// http POST localhost:8000/user/123?id=foo |
This file contains hidden or 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
'use strict'; | |
const Hapi = require('hapi'); | |
const Boom = require('boom'); | |
const server = new Hapi.Server(); | |
server.connection({ port: 8000 }); | |
// test by using this in browser: | |
// http://localhost:8000 | |
server.register(require('vision'), () => { |
OlderNewer