Skip to content

Instantly share code, notes, and snippets.


Cristiano Diniz da Silva mcloide

View GitHub Profile
vukanac /
Created Aug 20, 2017
How to install php72 on Mac OS X with homebrew.

Skip this:

brew tap homebrew/dupes
brew tap homebrew/versions


Warning: homebrew/dupes was deprecated. This tap is now empty as all its formulae were migrated.
Warning: homebrew/versions was deprecated. This tap is now empty as all its formulae were migrated.
fideloper /
Last active Sep 8, 2020
Update curl on Ubuntu 14.04
#! /usr/bin/env bash
# Install any build dependencies needed for curl
sudo apt-get build-dep curl
# Get latest (as of Feb 25, 2016) libcurl
mkdir ~/curl
cd ~/curl
tar -xvjf curl-7.50.2.tar.bz2
anonymous / Gruntfile.js
Created Jul 27, 2015
Sharing Configuration with Grunt
View Gruntfile.js
module.exports = function(grunt) {
grunt.registerTask('default', ['concat', 'less', 'jshint', 'watch']);
kennwhite /
Last active Jul 17, 2020
Most VPN Services are Terrible

Most VPN Services are Terrible

Short version: I strongly do not recommend using any of these providers. You are, of course, free to use whatever you like. My TL;DR advice: Roll your own and use Algo or Streisand. For messaging & voice, use Signal. For increased anonymity, use Tor for desktop (though recognize that doing so may actually put you at greater risk), and Onion Browser for mobile.

This mini-rant came on the heels of an interesting twitter discussion:

View gist:5828495
System Information
Time of this report: 1/25/2013, 16:51:06
Operating System: Windows 7 Professional 64-bit (6.1, Build 7601) Service Pack 1 (7601.win7sp1_gdr.120830-0333)
Language: English (Regional Setting: English)
System Manufacturer: CLEVO CO.
System Model: W35_37ET
BIOS: BIOS Date: 10/26/12 14:53:27 Ver: 04.06.05
Processor: Intel(R) Core(TM) i7-3630QM CPU @ 2.40GHz (8 CPUs), ~2.4GHz
nikic /
Last active Sep 15, 2020
Post explaining why objects often use less memory than arrays (in PHP)

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:

drawcode / mysql_drop_index_if_exists.sql
Last active Feb 29, 2020
MYSQL Drop Index If Exists
View mysql_drop_index_if_exists.sql
DROP PROCEDURE IF EXISTS drop_index_if_exists $$
CREATE PROCEDURE drop_index_if_exists(in theTable varchar(128), in theIndexName varchar(128) )
IF((SELECT COUNT(*) AS index_exists FROM information_schema.statistics WHERE TABLE_SCHEMA = DATABASE() and table_name =
theTable AND index_name = theIndexName) > 0) THEN
SET @s = CONCAT('DROP INDEX `' , theIndexName , '` ON `' , theTable, '`');
hectorcorrea / webserver.js
Last active Sep 3, 2020
web server in node.js
View webserver.js
// A very basic web server in node.js
// Stolen from: Node.js for Front-End Developers by Garann Means (p. 9-10)
var port = 8000;
var serverUrl = "";
var http = require("http");
var path = require("path");
var fs = require("fs");
var checkMimeType = true;
justinyost / paging.ctp
Created Mar 20, 2012
Paging Element for Twitter Bootstrap and CakePHP 2.0+
View paging.ctp
<?php $span = isset($span) ? $span : 8; ?>
<?php $page = isset($this->request->params['named']['page']) ? $this->request->params['named']['page'] : 1; ?>
<div class="pagination">
<?php echo $this->Paginator->prev(
'&larr; ' . __('Previous'),
'escape' => false,
'tag' => 'li'
ziadoz /
Last active Sep 16, 2020
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
You can’t perform that action at this time.