Skip to content

Instantly share code, notes, and snippets.

@sarciszewski
sarciszewski / PasswordLock.php
Last active August 29, 2015 14:16
Bcrypt + AES
<?php
namespace Sarciszewski\Gists;
/**
* This is a proof of concept code! DO NOT USE THIS!
*/
class PasswordLock
{
const KEY = '4ff556f7b1db2dd95906c21a45ef00344abdb38934450263ee7a908facc05070';
@krakjoe
krakjoe / demo.php
Last active December 2, 2016 05:28
PCNTL+pools+workers+pthreads
<?php
declare(ticks=1);
/*
This is your container for workers, it is only used in the process itself, so there is no need to descend from pthreads
*/
class Pool {
public $max;
public $config;
public $stop;
@colby
colby / sandman.sh
Created November 17, 2016 05:49
Put all of your Vagrant VMs to sleep.
#!/usr/bin/env sh
vagrant=$(which vagrant)
awk=$(which awk)
printf "Gathering a list of machines. "
machines=$(vagrant global-status --prune 2>/dev/null | $awk '/running/ {print $5}')
if [ ! -z "${machines[@]}" ]
then
@christian-blades-cb
christian-blades-cb / composer_lock_merge.coffee
Last active February 7, 2017 17:51
Merge composer.lock files
#!/usr/bin/env coffee
#################################################################
# credit goes to: jphass, because I totally ripped off his code #
# (https://gist.github.com/jphaas/ad7823b3469aac112a52) #
#################################################################
#################################################################################################
# INSTALLING #
# #
@jmauerhan
jmauerhan / pre-commit.php
Last active July 13, 2018 22:48
A pre-commit hook written in php to fix code style and alert about phpmd rules
#!/usr/bin/php
<?php
require __DIR__ . '/../../vendor/autoload.php';
/**
* Dependencies:
* - Symfony Console Component: symfony/console
* - Symfony Process Component: symfony/process
* - PHP Mess Detector: phpmd/phpmd
@rex
rex / favorite-libraries.md
Last active July 29, 2018 12:50
A list of my favorite libraries, grouped for sanity
@colby
colby / bump
Last active March 6, 2019 16:56
Bumps a git tag and metadata.rb version for a given Chef cookbook, follows SemVer standards.
#!/bin/bash
set -eo pipefail
semver_regex="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$"
usage="\
Usage:
$0
$0 show
sudo rm -rf /
@andyjbas
andyjbas / gist:9962218
Last active June 23, 2020 13:33
Disable CSS Animations in Poltergeist & Phantomjs. Phantomjs does not like to wait for animations, and you can run in to nasty test flickers because of it. This pattern will disable animations in test env, and not touch any app code.
# env.rb or spec_helper.rb

Capybara.register_driver :poltergeist do |app|
  opts = {
    extensions: ["#{Rails.root}/features/support/phantomjs/disable_animations.js"] # or wherever
  }

  Capybara::Poltergeist::Driver.new(app, opts)
end
@CHH
CHH / .gitignore
Created August 2, 2011 21:09
PHP Templating Engine with bindable $this support in 53 LOC
vendor/
composer.lock