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
# | |
# Slightly tighter CORS config for nginx | |
# | |
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs | |
# | |
# Despite the W3C guidance suggesting that a list of origins can be passed as part of | |
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox) | |
# don't seem to play nicely with this. | |
# |
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
//console.log(stringDateToEpoch("2016-01-31T21:52:02.607Z")) | |
var obj = { "rank_history": [ | |
{"date": "2016-02-17T04:27:16.773Z","rank": 121}, | |
{"date": "2016-02-15T05:37:16.773Z","rank": 122}, | |
[1455763092,153], | |
[1455761092,154], | |
{"date": "2016-02-14T02:27:16.773Z","rank": 125}, | |
[1455781509,156] | |
] |
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
#!/bin/bash | |
# Install prerequisites | |
yum install -y gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel ruby-devel gcc-c++ jq git | |
# Import key | |
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - | |
# Install RVM | |
curl -sSL https://get.rvm.io | bash -s stable --ruby |
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
check process elasticsearch with pidfile /var/run/elasticsearch.pid | |
start program = "/etc/init.d/elasticsearch start" | |
stop program = "/etc/init.d/elasticsearch stop" | |
if 5 restarts within 5 cycles then timeout | |
if failed host 127.0.0.1 port 9200 protocol http then restart |
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 getOutputResolution(max_width, max_height, videoInfo) { | |
var tmp_max_width = 0 | |
var tmp_max_height = 0 | |
// ShrinkToFit: don't scale up videos | |
max_width = (max_width > videoInfo.width) ? videoInfo.width : max_width | |
max_height = (max_height > videoInfo.height) ? videoInfo.height : max_height | |
if (videoInfo.width < videoInfo.height) { // for portrait | |
tmp_max_width = Math.min(max_width, max_height) // getting the smallest number for width | |
tmp_max_height = Math.max(max_width, max_height) // getting the biggest number for height |
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
#!/bin/bash | |
# This scripts scans the elasticsearch source code for all the registered REST endpoints | |
# It will put the formatted output in $DEFINITIONOUTPUTFILE | |
# [MethodName] [HttpVerb] [Route] | |
ESFOLDER="../elasticsearch" | |
DEFINITIONOUTPUTFILE="src/Generated/rest-actions.txt" | |
# Find all the lines that registerHandlers |
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
#--- | |
# iPIN - iPhone PNG Images Normalizer v1.0 | |
# Copyright (C) 2007 | |
# | |
# Author: | |
# Axel E. Brzostowski | |
# http://www.axelbrz.com.ar/ | |
# [email protected] | |
# | |
# References: |
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
# Helper method to fix Apple's stupid png optimizations | |
# Adapted from: | |
# http://www.axelbrz.com.ar/?mod=iphone-png-images-normalizer | |
# https://github.com/peperzaken/iPhone-optimized-PNG-reverse-script/blob/master/Peperzaken/Ios/DecodeImage.php | |
# PNG spec: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html | |
require 'zlib' | |
require 'logger' | |
module PNG |
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
/** | |
* Create a web friendly URL slug from a string. | |
* | |
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support. | |
* | |
* Although supported, transliteration is discouraged because | |
* 1) most web browsers support UTF-8 characters in URLs | |
* 2) transliteration causes a loss of information | |
* | |
* @author Sean Murphy <sean@iamseanmurphy.com> |
OlderNewer