Skip to content

Instantly share code, notes, and snippets.

apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
<?php
$v = "0";
if ($v) {
echo "truthy";
} else {
echo "falsy";
}
@matejd
matejd / Vagrantfile
Created January 7, 2017 13:59
apache, mysql, phpmyadmin Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# TODO: https://gist.github.com/rrosiek/8190550
# TODO: replace with php7
# apt-get install php5 php5-cli php5-xdebug php5-mysql libapache2-mod-php5 php5-curl -y
$script = <<SCRIPT
echo Provisioning...
Plugin 'AndrewRadev/sideways.vim'
" Move function arguments left or right
" https://github.com/AndrewRadev/sideways.vim
:set winaltkeys=no
execute "set <M-h>=\eh"
execute "set <M-l>=\el"
nnoremap <M-h> h
nnoremap <M-l> l
var ajax = {
/**
* Example:
* <code>
* ajax.get('/definition', { id: 42 })
* .fail(function() {
* console.log('We failed to retrieve definition! Do something else.');
* })
* .done(function(definition) {
* console.log(definition);
/**
* Example:
* <code>
* var ajax = require('./ajax.js');
*
* ajax.get('/definition', { id: 42 })
* .fail(() => {
* console.log('We failed to retrieve definition! Do something else.');
* })
* .done((definition) => {
#
# deb cdrom:[Debian GNU/Linux 7 _Wheezy_ - Official Snapshot amd64 LIVE/INSTALL Binary 20141121-01:47]/ wheezy main
#deb http://ftp.us.debian.org/debian/ wheezy main
#deb-src http://ftp.us.debian.org/debian/ wheezy main
#deb http://security.debian.org/ wheezy/updates main
#deb-src http://security.debian.org/ wheezy/updates main
# wheezy-updates, previously known as 'volatile'
#deb http://ftp.us.debian.org/debian/ wheezy-updates main
<?php
// Transactions. Any exception in the closure
// will rollback the transaction. Otherwise the transaction
// will be automatically committed.
$id = $_POST['id']; // from input, no need for escaping, it's done by DB (PDO).
DB::transaction(function() use($id) {
DB::update('UPDATE account SET balance = balance - ? WHERE id = ?', [500, $id]);
@matejd
matejd / found_rows.php
Last active August 29, 2015 14:18
SQL_CALC_FOUND_ROWS
$sql = 'SELECT SQL_CALC_FOUND_ROWS
_user.id AS id,
_user.firstname AS firstname,
_user.surname AS surname,
wp.title AS workplace,
SUM(IF(ug.id IS NOT NULL, 1,0)) AS num_goals,
SUM(IF(ug.status = 2, 1,0)) AS num_active_goals
FROM _user
LEFT JOIN workplace wp ON _user.workplace_id=wp.workplace_id
LEFT JOIN _user_goal ug ON _user.id=ug.fk_user
<!-- https://jsfiddle.net/1u9sezp4/ -->
<form>
<label>Description</label><br />
<textarea name="description"></textarea>
<br />
<label>Evaluation</label><br />
<textarea name="evaluation"></textarea>
<br />