Skip to content

Instantly share code, notes, and snippets.

@bladeofsteel
bladeofsteel / docker-run-user.sh
Created May 9, 2018 18:49 — forked from marten-cz/docker-run-user.sh
Run docker with current user
# Run command with the same user ID as current user
# -v $(pwd):/tmp/mount - mount current directory to /tmp/mount/
# --env HOME="/tmp/" - some commands may need to be able to write to your home, se it to temporary folder
docker run -ti --rm -v $(pwd):/tmp/mount —user=$(id -u) --env HOME="/tmp/" debian:jessie
# Mount current users and group and be able to use them
# mount /etc/group and /etc/passwd read only
# set user from $USER
docker run -ti --rm -v $(pwd):/tmp/mount -w /tmp/hx -v /etc/group:/etc/group:ro -v /etc/passwd:/etc/passwd:ro —user=$USER debian:jessie
#!/usr/bin/env bash
MODULE_DIR="module"
TEST_DIR="/test"
DOCS_DIR="/docs"
COVERAGE_DIR=$PWD"/docs/coverage/"
COVERAGE_INDEX=$COVERAGE_DIR$MODULE_DIR"/index.html"
BOOTSTRAP_FILE="Bootstrap.php"
PHPUNIT_FILE="phpunit.xml"
<?php
define('T', ' ');
define('N', PHP_EOL);
$functions = array();
$classes = array();
$constant_prefix = 'X_';
$php = '<?php' . N;
@bladeofsteel
bladeofsteel / Doctrine2.php
Created May 31, 2012 10:18 — forked from memphys/Doctrine2.php
Doctrine2 auth adapter to use with Zend_Auth
<?php
class My_Auth_Adapter_Doctrine2 implements Zend_Auth_Adapter_Interface
{
/**
* Doctrine Entity Manager
*
* @var \Doctrine\ORM\EntityManager
*/
protected $_em = null;
@bladeofsteel
bladeofsteel / jQuery.ajaxQueue.min.js
Created May 21, 2012 14:19 — forked from gnarf/jQuery.ajaxQueue.min.js
jQuery.ajaxQueue - A queue for ajax requests
/*
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
*/
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).then(b,b).done(e.resolve).fail(e.reject)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery)
@bladeofsteel
bladeofsteel / ZfClassmapTask.php
Created January 11, 2012 22:33 — forked from shevron/ZfClassmapTask.php
Zend Framework 2.0 style autoloader classmap generator task for Phing
<?php
/**
* Phing task to generate a Zend Framework style autoloader classmap file
*
* This task requires ZF 2.x to be in your include_path. You can run phing like
* so to enforce this:
*
* $ export PHP_COMMAND="php -d include_path=.:<path to zf library>:<path to pear>"
* $ phing ...
@bladeofsteel
bladeofsteel / async_process.py
Created December 28, 2011 13:00 — forked from stephenwilley/async_process.py
Module type version of original with gen example
# Adapted from here: https://gist.github.com/489093
# Original credit goes to pplante and copyright notice pasted below
# Copyright (c) 2010, Philip Plante of EndlessPaths.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@bladeofsteel
bladeofsteel / h5bp-twitter-bootstrap
Created December 6, 2011 08:01 — forked from mklabs/bootstrap-plugins.txt
h5bp + twitter bootstrap integration
#!/bin/sh
echo "
Cool, let's start.
"
src=$PWD
@bladeofsteel
bladeofsteel / bcrypt.php
Created October 2, 2011 06:51 — forked from dzuelke/bcrypt.php
How to use bcrypt in PHP to safely store passwords (PHP 5.3+ only)
<?php
// secure hashing of passwords using bcrypt, needs PHP 5.3+
// see http://codahale.com/how-to-safely-store-a-password/
// salt for bcrypt needs to be 22 base64 characters (but just [./0-9A-Za-z]), see http://php.net/crypt
// just an example; please use something more secure/random than sha1(microtime) :)
$salt = substr(str_replace('+', '.', base64_encode(sha1(microtime(true), true))), 0, 22);
// 2a is the bcrypt algorithm selector, see http://php.net/crypt
$ find /path/to -type d -exec chmod 775 {} \;
$ find /path/to -type f -exec chmod 664 {} \;