Skip to content

Instantly share code, notes, and snippets.

View zot24's full-sized avatar
🦑
boom!

zot24

🦑
boom!
View GitHub Profile
@zot24
zot24 / install.sh
Created March 22, 2016 14:25 — forked from solar/install.sh
install memcached from source with supervisord
#!/bin/sh
version="1.4.15"
priority="10415"
libevent="/usr/local/libevent/2.0.20-stable/"
supervisordir="/etc/supervisord.d"
# create user
sudo groupadd memcached
sudo useradd -r -g memcached -s /sbin/nologin -M -d /var/run/memcached memcached
@zot24
zot24 / multipart.lua
Created November 10, 2015 10:25
Multipart Parser for Lua based on Mashape (Multipart Parser for Lua)
local function loadFormInput ()
local result = {
data = {},
indexes = {}
}
-- Should be set to 4096 or 8192 for real-world settings
local chunk_size = 4096
local form, err = upload:new(chunk_size)
@zot24
zot24 / paginate_collection.php
Created June 23, 2015 08:53
Create your own LengthAwarePaginator with Laravel from a Collection
$page = $request->input('page') ?: 1;
$total = $collection->count();
$start = ($page - 1) * $request->input('limit');
$slice = $collection->slice($start, $request->input('limit'), true);
$paginator = new LengthAwarePaginator(
$slice->all(),
$total,
$request->input('limit'),
$request->input('page') ?: null,
@zot24
zot24 / after.sh
Last active October 29, 2019 07:26
Laravel Homestead after.sh script
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
echo "Updating machine software"
locale-gen en_GB.UTF-8
# Updating composer
@zot24
zot24 / stripe.js.coffee
Created January 7, 2015 09:41
Stripe Payment Form
$(document).ready ->
Stripe.setPublishableKey(window.stripe_pk);
stripeResponseHandler = (status, response) ->
if (response.error)
# re-enable the submit button
#$('.submit-button').removeAttr("disabled")
else
form$ = $("#formPaymentDetails")
# token contains id, last4, and card type
@zot24
zot24 / export_jenkins_job
Created December 8, 2014 09:51
How to export a Jenkins job
java -jar /opt/jenkins-cli.jar -s http://localhost:8080 get-job Contactzilla > contactzilla.xml
@zot24
zot24 / clean_jenkins.sh
Last active August 29, 2015 14:10
Jenkins CI Server – Resetting a build number and cleaning a build - http://goo.gl/WLlXYV
#
# Jenkins build cleaner
# Cleans out all builds for projects that exist in the directory
# Resets the build number to 1
# Backup all projects before running this
 
function cleanbuild {
 
echo "cleaning $1"
cd $1
@zot24
zot24 / phpdox
Created November 28, 2014 11:32
PHP Dox example config file
<?xml version="1.0" encoding="utf-8" ?>
<phpdox xmlns="http://phpdox.net/config">
<project name="MyProjectName" source="MyBaseDir" workdir="phpdox">
<collector publiconly="false">
<include mask="*/source1/**/*.php" />
<include mask="*/source2/**/*.php" />
<exclude mask="*autoload.php" />
</collector>
<generator output=".">
@zot24
zot24 / post.md
Last active August 29, 2015 14:10
My personal boilerplate for write a posts using the blogging platform Ghost - blog.zot24.com

[Series]

Short explanation about the series


Introdution, explaining which is the gloal of the post and what are the motivation to face this problem, is basically a very short resume or explanation about what the user is going to read.

<?php
// credential to access github, you should choose between username/password authentication or token (for two step verification accounts)
$githubUser = 'YOURGITHUBUSER';
$githubPasswd = 'YOURGITHUBPASSWD';
// or
//$githubToken = 'YOURGITHUBTOKEN';
$githubOrganization = 'YOURGITHUBORGANIZATION';