Skip to content

Instantly share code, notes, and snippets.

const date = new Date(Date.UTC(2020, 04, 14, 3, 0, 0));
const options = { month: "long", day: "numeric" };
console.log(new Intl.DateTimeFormat('en-US', options).format(date));
console.log(new Intl.DateTimeFormat('fr-FR', options).format(date));
console.log(new Intl.DateTimeFormat('it-IT', options).format(date));
console.log(new Intl.DateTimeFormat('nl-NL', options).format(date));
@renan
renan / healthy
Created March 21, 2018 21:18
pprof
goroutine 255 [running]:
runtime/pprof.writeGoroutineStacks(0x3006840, 0xc4205d62a0, 0x0, 0xc4202c6ad0)
/root/.gimme/versions/go1.9.4.linux.amd64/src/runtime/pprof/pprof.go:608 +0xa7
runtime/pprof.writeGoroutine(0x3006840, 0xc4205d62a0, 0x2, 0x30, 0x1d60f20)
/root/.gimme/versions/go1.9.4.linux.amd64/src/runtime/pprof/pprof.go:597 +0x44
runtime/pprof.(*Profile).WriteTo(0x2fb2a40, 0x3006840, 0xc4205d62a0, 0x2, 0xc4205d62a0, 0x3088400)
/root/.gimme/versions/go1.9.4.linux.amd64/src/runtime/pprof/pprof.go:310 +0x3ab
net/http/pprof.handler.ServeHTTP(0xc4208401f1, 0x9, 0x3024740, 0xc4205d62a0, 0xc4203ba900)
/root/.gimme/versions/go1.9.4.linux.amd64/src/net/http/pprof/pprof.go:237 +0x1b8
net/http/pprof.Index(0x3024740, 0xc4205d62a0, 0xc4203ba900)
@renan
renan / main.php
Created September 12, 2016 13:59
<?php
if (extension_loaded('xdebug')) {
// Use a empty php.ini and not extra ini files
putenv('PHP_INI_SCAN_DIR=/tmp/composer-php-empty');
passthru('php -c php.ini main.php', $exitCode);
} else {
// Run with the env var
passthru('php sub.php', $exitCode);
@renan
renan / keybase.md
Created April 12, 2016 13:08
keybase.md

Keybase proof

I hereby claim:

  • I am renan on github.
  • I am renan (https://keybase.io/renan) on keybase.
  • I have a public key whose fingerprint is 6F48 05B0 CB8F A824 8C97 90E8 5B11 E317 B3A1 0369

To claim this, I am signing this object:

<?php
class OneEntryCacheEngine extends CacheEngine {
protected $_dirty = false;
protected $_data = false;
public function read($key) {
if ($this->_data === false) {
$this->_data = (array)Cache::read($this->_config['cacheKey'], $this->_config['cacheConfig']);
}
@renan
renan / default.json
Last active December 24, 2015 09:39
{
"run_list": [
"recipe[nginx]"
],
"default_attributes": {
"nginx": {
"dir" : "/etc/nginx",
"log_dir" : "/var/log/nginx",
"binary" : "/usr/sbin/nginx",
"user" : "www-data",
diff --git a/lib/Cake/Utility/String.php b/lib/Cake/Utility/String.php
index f6d9bf4..aea9421 100644
--- a/lib/Cake/Utility/String.php
+++ b/lib/Cake/Utility/String.php
@@ -358,25 +358,20 @@ class String {
* @return string Formatted text.
*/
public static function wordWrap($text, $width = 72, $break = "\n", $cut = false) {
- $widthAndBoundary = $cut ? '{' . $width . '}#' : '{' . $width . ',}\b#U';
- $regexp = '#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+)' . $widthAndBoundary;
This file has been truncated, but you can view the full file.
make[2]: Entering directory `/pdf/wkhtmltopdf-qt/src/3rdparty/webkit/Source/WebKit/qt/tests'
cd qwebframe/ && make -f Makefile.WebKit
cd qwebpage/ && make -f Makefile.WebKit
cd qwebelement/ && make -f Makefile.WebKit
make[3]: Entering directory `/pdf/wkhtmltopdf-qt/src/3rdparty/webkit/Source/WebKit/qt/tests/qwebelement'
g++ -Wl,-rpath-link,/pdf/wkhtmltopdf-qt/lib -m64 -Wl,-O1 -Wl,-rpath,/pdf/wkhtmltopdf-qt/src/3rdparty/webkit/Source/lib -Wl,-rpath,/pdf/wkqt/lib -Wl,-rpath,/pdf/wkqt/lib -o tst_qwebelement .obj/release-static/tst_qwebelement.o .obj/release-static/qrc_tst_qwebelement.o -L/pdf/wkhtmltopdf-qt/lib -L/usr/X11R6/lib64 -L/pdf/wkhtmltopdf-qt/lib -lQtWebKit -L../../WebCore/release -L../../JavaScriptCore/release -L/usr/X11R6/lib64 -lwebcore -ljscore -lgio-2.0 -lgstapp-0.10 -lgstinterfaces-0.10 -lgstpbutils-0.10 -pthread -lgstvideo-0.10 -lgstbase-0.10 -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lxml2 -lglib-2.0 -lQtTest -lQtGui -lXrender -lfontconfig -lfreetype -lXext -lX11 -lQtNetwork
@renan
renan / gist:6698775
Last active December 23, 2015 21:49
language: php
php:
- 5.3
- 5.4
- 5.5
env:
global:
- CAKE_VERSION=2.5
diff --git a/webroot/index.php b/webroot/index.php
index 6c071ac..f77be14 100644
--- a/webroot/index.php
+++ b/webroot/index.php
@@ -22,6 +22,10 @@
// for built-in server
if (php_sapi_name() === 'cli-server') {
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
+
+ if (file_exists(__DIR__ . $_SERVER['REQUEST_URI'])) {