Skip to content

Instantly share code, notes, and snippets.

Avatar

Cristiano Diniz da Silva mcloide

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

Skip this:

brew tap homebrew/dupes
brew tap homebrew/versions

As:

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
fideloper / update_curl.sh
Last active Sep 8, 2020
Update curl on Ubuntu 14.04
View update_curl.sh
#! /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
wget http://curl.haxx.se/download/curl-7.50.2.tar.bz2
tar -xvjf curl-7.50.2.tar.bz2
anonymous
anonymous / Gruntfile.js
Created Jul 27, 2015
Sharing Configuration with Grunt
View Gruntfile.js
module.exports = function(grunt) {
require('./config.js')(grunt);
grunt.registerTask('default', ['concat', 'less', 'jshint', 'watch']);
};
@kennwhite
kennwhite / vpn_psk_bingo.md
Last active Jul 17, 2020
Most VPN Services are Terrible
View vpn_psk_bingo.md

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: https://twitter.com/kennwhite/status/591074055018582016

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
nikic / objects_arrays.md
Last active Sep 15, 2020
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:

@drawcode
drawcode / mysql_drop_index_if_exists.sql
Last active Feb 29, 2020
MYSQL Drop Index If Exists
View mysql_drop_index_if_exists.sql
DELIMITER $$
DROP PROCEDURE IF EXISTS drop_index_if_exists $$
CREATE PROCEDURE drop_index_if_exists(in theTable varchar(128), in theIndexName varchar(128) )
BEGIN
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, '`');
PREPARE stmt FROM @s;
EXECUTE stmt;
@hectorcorrea
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 = "127.0.0.1";
var http = require("http");
var path = require("path");
var fs = require("fs");
var checkMimeType = true;
@justinyost
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">
<ul>
<?php echo $this->Paginator->prev(
'&larr; ' . __('Previous'),
array(
'escape' => false,
'tag' => 'li'
),
@ziadoz
ziadoz / awesome-php.md
Last active Sep 16, 2020
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
View awesome-php.md
You can’t perform that action at this time.