Skip to content

Instantly share code, notes, and snippets.

View carlwiedemann's full-sized avatar

Carl Wiedemann carlwiedemann

View GitHub Profile
@carlwiedemann
carlwiedemann / probo-step.yaml
Created January 11, 2017 18:17
PHP7 on probo
- name: Add php7
plugin: Script
script: |
echo 'exit 0' > /usr/sbin/policy-rc.d
apt-get update
apt-get install -y software-properties-common language-pack-en-base
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y php7.0 libapache2-mod-php7.0 php7.0-gd php7.0-curl php7.0-json php7.0-mbstring php7.0-mysql php7.0-mcrypt php7.0-imagick php7.0-dev php7.0-gmp php7.0-xml php7.0-bcmath php7.0-redis php7.0-uploadprogress php7.0-soap php7.0-pgsql
cp /etc/php5/mods-available/general_settings.ini /etc/php/7.0/apache2/conf.d/20-general_settings.ini
<html>
<head><title>hello banana</title></head>
<style media="screen">
div {
margin-bottom: 2px;
}
.outer-container {
position: relative;
Libraries We Use
The following sets forth attribution notices for third party software that may be contained in portions of the Instagram product. We thank the open source community for all of their contributions.
AFNetworking
The following software may be included in this product: AFNetworking. This software contains the following license and notice below:
Copyright (c) 2011 Gowalla (http://gowalla.com/)
@carlwiedemann
carlwiedemann / how-big.sql
Created December 15, 2015 19:00
How big are your tables?
SELECT table_schema as `Database`, table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;
@carlwiedemann
carlwiedemann / bday.rb
Created December 12, 2015 21:46
Is your birthday a right triangle?
require 'date'
dates = Date.parse('2001-01-01')..Date.parse('2999-12-31')
dates.map do | date |
if (date.year - 2000) ** 2 - date.month ** 2 - date.mday ** 2 == 0
puts date
end
end
<?php
$map = function ($fun, $arr) {
return array_reduce($arr, function ($carry, $item) use ($fun) {
return array_merge($carry, [$fun($item)]);
}, []);
};
$max = function ($arr) {
return array_reduce($arr, function ($carry, $item) {
<?php
class ClassA {}
function foo(ClassA $bar) {
var_dump($bar);
}
foo('hi');
<?php
include 'infra-puppet/files/drushrc.php';
$tables = $options['structure-tables']['common'];
sort($tables);
print_r($tables);
<?php
class Employee {
private $type;
const BASE_SALARY = 500;
function __construct(EmployeeType $type) {
$this->type = $type;
<?php
class Employee {
private $type;
const BASE_SALARY = 500;
function __construct(EmployeeType $type) {
$this->type = $type;