This proposal is not longer active. Context: https://twitter.com/siddharthkp/status/909818777314902016
<?php | |
// Run this as follows: | |
// php import-xhprof-to-xhgui.php -d /dir/to/xhprof/runs/ | |
// | |
// Based on https://github.com/perftools/xhgui/blob/master/external/import.php | |
if (!defined('XHGUI_ROOT_DIR')) { | |
require __DIR__ . '/src/bootstrap.php'; | |
} |
<?php | |
/** | |
* @license GPLv3 (or any later version) | |
* @see http://kizu514.com/blog/refactor-your-slow-form-using-php-generators-and-event-streams/ | |
*/ | |
namespace KIZU514; | |
class EventEmitter | |
{ |
This proposal is not longer active. Context: https://twitter.com/siddharthkp/status/909818777314902016
I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.
There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*
, e.g.:
:vs **/*<partial file name><Tab>
use Drupal\Core\Url; | |
use Symfony\Component\HttpFoundation\Request; | |
function my_function() { | |
$previousUrl = \Drupal::request()->server->get('HTTP_REFERER'); | |
$fake_request = Request::create($previousUrl); | |
$url_object = \Drupal::service('path.validator')->getUrlIfValid($fake_request->getRequestUri()); | |
if ($url_object) { | |
$route_name = $url_object->getRouteName(); | |
// Do something with $route_name; |
<?php | |
// ... | |
use Symfony\Component\HttpFoundation\Response; | |
// Then later on (inside your controller's class), you have a function used | |
// for the route_name (on a hook_menu() item in your .module file), this | |
// function can return a JSON response... |
var gulp = require('gulp'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var browserify = require('browserify'); | |
var watchify = require('watchify'); | |
var babel = require('babelify'); | |
function compile(watch) { | |
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel)); |
Below are many examples of function hoisting behavior in JavaScript. Ones marked as works
successfuly print 'hi!' without errors.
To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js
(I may be using incorrect terms below, please forgive me)
// Add / Update a key-value pair in the URL query parameters | |
function updateUrlParameter(uri, key, value) { | |
// remove the hash part before operating on the uri | |
var i = uri.indexOf('#'); | |
var hash = i === -1 ? '' : uri.substr(i); | |
uri = i === -1 ? uri : uri.substr(0, i); | |
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); | |
var separator = uri.indexOf('?') !== -1 ? "&" : "?"; | |
if (uri.match(re)) { |
Let's say alice
is a github.com user, with 2 or more private repositories repoN
.
For this example we'll work with just two repositories named repo1
and repo2
https://github.com/alice/repo1
https://github.com/alice/repo2
You need to be to pull from these repositories without entering a passwords probably on a server, or on multiple servers.