Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / config.json
Created March 28, 2016 02:46
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "#3E4862",
"@brand-success": "#5cb85c",
@Razoxane
Razoxane / reverse_anti-join.sql
Last active July 29, 2016 05:00
Preferred way to suppress reversed journal entries
SELECT je.*
FROM journal_entry AS je ON a.assetID = je.assetID
AND je.reference IN ('OPEN','AQ','DR')
AND CASE WHEN je.reference = 'DR' THEN je.description LIKE 'Direct Reinvestment%' ELSE 1=1 END
AND je.entryType = 'debit'
AND IFNULL(je.assetID,0) > 0
/* some join conditions for the je table, can vary depending on what's being joined (account or asset) */
LEFT JOIN journal_entry AS aj ON je.fundID = aj.fundID
AND je.memberAccountID = aj.memberAccountID
@clouddueling
clouddueling / composer.yaml
Created May 6, 2014 23:52
ElasticBeanstalk PHP Composer Config
commands:
01updateComposer:
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update &&
02installVendors:
command: /usr/bin/composer.phar install --no-dev
option_settings:
- namespace: aws:elasticbeanstalk:application:environment
option_name: COMPOSER_HOME
value: /root
@paulferrett
paulferrett / timezones_and_geo_coordinates.csv
Created May 16, 2016 10:32
List of Timezones and their Geo Coordinates
Africa/Abidjan 5.359952 -4.008256 +0:00
Africa/Accra 5.603717 -0.186964 +0:00
Africa/Addis_Ababa 8.980603 38.757761 +03:00
Africa/Algiers 36.75377 3.058793 +01:00
Africa/Asmera 15.322877 38.925052 +03:00
Africa/Bamako 12.639232 -8.002889 +0:00
Africa/Bangui 4.394674 18.55819 +01:00
Africa/Banjul 13.454876 -16.579032 +0:00
Africa/Bissau 11.881655 -15.617794 +0:00
Africa/Blantyre -15.766671 35.016787 +02:00
@katronai
katronai / consume-soap.js
Last active June 7, 2018 12:43
Node.js, AWS Lambda - Consume a SOAP service that requires WS-Addressing and v1.2 specification using node-soap module
var soap = require('soap');
var url = 'http://example.org/MyWebService.svc?wsdl';
var soapOptions = {
forceSoap12Headers: true
};
var soapHeader = {
'wsa:Action': 'http://tempuri.org/MyBinding/MyOperation',
@paulferrett
paulferrett / ordinal_suffix.php
Last active July 2, 2018 21:23
Here's a function to get the ordinal suffix of an integer in PHP.
<?php
/**
* Get the ordinal suffix of an int (e.g. th, rd, st, etc.)
*
* @param int $n
* @param bool $return_n Include $n in the string returned
* @return string $n including its ordinal suffix
*/
function ordinal_suffix($n, $return_n = true) {
@paultreny
paultreny / tidy.conf
Created March 28, 2014 00:09
The config file I use for tidy-html5. $ tidy -config <path/to/tidy.conf> input.html > output.html
// paulcode.com
// tidy-html5 config file (mine's named "tidy.conf")
// tidy documentation is here: http://tidy.sourceforge.net/#docs
// tidy-html5 documentation here: http://w3c.github.io/tidy-html5/quickref.html#drop-empty-elements
join-classes: no
logical-emphasis: no
drop-empty-elements: no
anchor-as-name: no
doctype: auto
@coldnebo
coldnebo / Default (OSX).sublime-keymap -- User
Created February 3, 2012 16:21
Sublime Text 2 fix for OSX home/end keys
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} }
@iwek
iwek / traceroute.php
Last active April 1, 2020 15:03
PHP Curl call to get a Traceroute with Pingdom API
<?php
//initialize
$ch = curl_init();
// 2. set the options, including the url
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_URL, "https://api.pingdom.com/api/2.0/traceroute?host=techslides.com");
curl_setopt($ch, CURLOPT_USERPWD, "EMAIL:PASSWORD");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("App-Key: YOUR-KEY-HERE"));
@FrankFang
FrankFang / banker_round.js
Created April 5, 2014 06:40
Gaussian/Banker's Rounding in JavaScript
function evenRound(num, decimalPlaces) {
var d = decimalPlaces || 0;
var m = Math.pow(10, d);
var n = +(d ? num * m : num).toFixed(8); // Avoid rounding errors
var i = Math.floor(n), f = n - i;
var e = 1e-8; // Allow for rounding errors in f
var r = (f > 0.5 - e && f < 0.5 + e) ?
((i % 2 == 0) ? i : i + 1) : Math.round(n);
return d ? r / m : r;
}