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
const id = Random.id(); | |
const bitEncode = (s) => { | |
let binString = ''; | |
for (let i = 0; i < s.length; i++) { | |
const bin = (s.charCodeAt(i) - 20).toString(2); | |
const binSubString = (`0000000000${bin}`).slice(-7); | |
binString += binSubString; | |
} |
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
// Load this script: https://github.com/mongodb/mongo-csharp-driver/blob/master/uuidhelpers.js | |
// Start your mongo-shell with this script: mongo --shell uuidhelpers.js | |
// Find out what type of UUID it was. In my case it was PYUUID(). But it could (in your case) also be CSUUID() or JUUID(). | |
db.tests.find(function() { return this.orderId.subtype() == 3 }).snapshot().forEach(function(elem) { | |
db.tests.update( | |
{ | |
_id: elem._id | |
}, |
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 decode_base64(s) { | |
var e={},i,k,v=[],r='',w=String.fromCharCode; | |
var n=[[65,91],[97,123],[48,58],[43,44],[47,48]]; | |
for(z in n){for(i=n[z][0];i<n[z][1];i++){v.push(w(i));}} | |
for(i=0;i<64;i++){e[v[i]]=i;} | |
for(i=0;i<s.length;i+=72){ | |
var b=0,c,x,l=0,o=s.substring(i,i+72); | |
for(x=0;x<o.length;x++){ |
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 | |
# | |
# Notify of Homebrew updates via Notification Center on Mac OS X | |
# | |
# Author: Chris Streeter http://www.chrisstreeter.com | |
# Requires: terminal-notifier. Install with: | |
# brew install terminal-notifier | |
TERM_APP='/Applications/Terminal.app' | |
BREW_EXEC='/usr/local/bin/brew' |
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
<?php | |
$timezones = DateTimeZone::listIdentifiers(); | |
$VTIMEZONE = array( | |
"TZID" => "Mitteleuropäische Zeit", | |
"DAYLIGHT" => array( | |
"RULE" => array( | |
"FREQ" => "YEARLY", | |
"BYDAY" => "-1SU", |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html --> | |
<phpunit | |
backupGlobals = "false" | |
backupStaticAttributes = "false" | |
colors = "true" | |
convertErrorsToExceptions = "true" | |
convertNoticesToExceptions = "true" | |
convertWarningsToExceptions = "true" |
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
/var/log/php5-fpm.log { | |
daily | |
rotate 21 | |
missingok | |
notifempty | |
sharedscripts | |
postrotate | |
kill -USR1 `cat /opt/php/logs/nginx.pid` | |
endscript | |
} |
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
server { | |
server_name localhost linos; | |
root /srv/http/$host/www; | |
index index.php index.html index.htm; | |
access_log /srv/http/$host/log/nginx.access.log; | |
error_log /srv/http/localhost/log/nginx.error.log; | |
location / { |
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
{# | |
Source: http://dev.dbl-a.com/symfony-2-0/symfony2-and-twig-pagination/ | |
Updated by: Simon Schick <simonsimcity@gmail.com> | |
Parameters: | |
* currentFilters (array) : associative array that contains the current route-arguments | |
* currentPage (int) : the current page you are in | |
* paginationPath (string) : the route name to use for links | |
* showAlwaysFirstAndLast (bool) : Always show first and last link (just disabled) | |
* lastPage (int) : represents the total number of existing pages |