Skip to content

Instantly share code, notes, and snippets.

View joeybeninghove's full-sized avatar

Joey Beninghove joeybeninghove

View GitHub Profile
@joeybeninghove
joeybeninghove / my-bash-prompt.sh
Last active December 16, 2016 22:07
My Bash Prompt
# set some pretty colors
export COLOR_NC='\e[0m' # No Color
export COLOR_BLUE='\e[0;34m'
export COLOR_GREEN='\e[0;32m'
export COLOR_RED='\e[0;31m'
# load cross
function get_cross {
echo -e "\xe2\x9c\x9d"
}
@joeybeninghove
joeybeninghove / payment-module-validate-order.php
Created November 30, 2016 17:36
PrestaShop Payment Module
<?php
/**
* Validate an order in database
* Function called from a payment module
*
* @param int $id_cart
* @param int $id_order_state
* @param float $amount_paid Amount really paid by customer (in the default currency)
* @param string $payment_method Payment method (eg. 'Credit card')
* @param null $message Message to attach to order
<?php
public function postProcess()
{
Resource::setSecretKey("sk_store_68b8bfedbea80675fcf1374e");
$cart = $this->context->cart;
$currency = Currency::getCurrencyInstance((int)$cart->id_currency);
$invoice = Invoice::create([
<?php
class Base extends Resource
{
public static $baseUrl = "http://api.cloudswipe.dev/v1/";
public static function setApiKey($apiKey)
{
parent::auth($apiKey);
}
}
@joeybeninghove
joeybeninghove / briefs-total-downloads.coffee
Last active February 22, 2016 21:37
briefs.fm total downloads
// ==UserScript==
// @name briefs.fm total downloads
// @namespace http://joey.io
// @version 0.1
// @description Add a total downloads number to your briefs.fm podcast home page
// @author Joey Beninghove
// @require http://coffeescript.org/extras/coffee-script.js
// @match https://www.briefs.fm/*
// ==/UserScript==
/* jshint ignore:start */
describe User, "password generation" do
context "when created" do
it "generates a random password" do
user = User.create(email: "john@doe.com")
expect(user.password).not_to be_empty
end
end
context "when updated" do
@joeybeninghove
joeybeninghove / pre-push
Created January 22, 2016 05:53
Gulp pre-push hook
#!/bin/sh
# Called by "git # push" after it has checked the remote status, but
# before anything has been pushed. If this script exits with a non-zero
# status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
<br />
<b>Deprecated</b>: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in <b>Unknown</b> on line <b>0</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent in <b>Unknown</b> on line <b>0</b><br />
So, in the scenario of:
file1=1
file2=2
file3=3
file4=4
file5=5
if you type in new positions for these 2 like this:
file2=1
file5=1