Skip to content

Instantly share code, notes, and snippets.

Christian Lück clue

Block or report user

Report or block clue

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@emiller
emiller / git-mv-with-history
Last active Nov 13, 2019
git utility to move/rename file or folder and retain history with it.
View git-mv-with-history
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
View pthreads.md

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls
@nikic
nikic / objects_arrays.md
Last active Nov 13, 2019
Post explaining why objects often use less memory than arrays (in PHP)
View objects_arrays.md

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

@loonies
loonies / 1_phpunit-api.md
Last active Nov 11, 2019
PHPUnit Cheat Sheet
View 1_phpunit-api.md

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this->anything()
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active Nov 11, 2019
HTTP Streaming (or Chunked vs Store & Forward)
View http_streaming.md

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@jbenet
jbenet / simple-git-branching-model.md
Last active Nov 8, 2019
a simple git branching model
View simple-git-branching-model.md

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@ziadoz
ziadoz / awesome-php.md
Last active Nov 5, 2019
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
View awesome-php.md
@vinkla
vinkla / CDN.md
Last active Nov 4, 2019
A guide on how to upload images to GitHub's CDN through issue and pull request text fields.
View CDN.md

Upload Images to GitHub's CDN

  1. First, visit any repository on GitHub and click your way through to the issues page.

  2. Create a new issue by clicking the New Issue button. You'll now see title and description fields.

  3. Drag-and-drop an image on to the description field. This will start the uploading process.

  4. Copy the URL and use it in README, issues or pull requests however you like.

@ImJasonH
ImJasonH / markdown.css
Last active Oct 19, 2019
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
View markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@mathiasverraes
mathiasverraes / TestFrameworkInATweet.php
Last active Oct 11, 2019
A unit testing framework in a tweet.
View TestFrameworkInATweet.php
<?php
function it($m,$p){echo ($p?'✔︎':'')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}
You can’t perform that action at this time.