Skip to content

Instantly share code, notes, and snippets.

View benfavre's full-sized avatar
💻
At the office

Webdesign29 benfavre

💻
At the office
View GitHub Profile
@benfavre
benfavre / xdebug-windows.ini
Last active October 7, 2016 15:31
Example XdebugConfig Windows
[XDebug]
zend_extension=php_xdebug.dll
xdebug.cli_color = 1
xdebug.overload_var_dump = 1
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = 4096
xdebug.var_display_max_depth = 10
xdebug.max_nesting_level = 250
xdebug.remote_enable=1
@benfavre
benfavre / .env.example
Created September 26, 2016 15:13
ENV file example
APP_DATABASE_NAME=%database_name%
APP_DATABASE_USER=%database_user%
APP_DATABASE_PASSWORD=%database_password%
APP_DATABASE_HOST=%database_host%
APP_ENV=%app_environment%
@benfavre
benfavre / boot_app.sh
Created September 26, 2016 15:12
Boot file
#!/bin/sh
export DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive
echo "App boot script"
export APP_DATABASE_HOST="db"
echo "Setup env variables"
/sbin/setuser www-app cp /var/www/html/.env.example /var/www/html/.env && \
sed -i "s|%database_name%|${APP_DATABASE_NAME}|g" /var/www/html/.env && \
sed -i "s|%database_user%|${APP_DATABASE_USER}|g" /var/www/html/.env && \
@benfavre
benfavre / .js
Created September 5, 2016 15:59
Serialize Form to JSON
(function ($) {
$.fn.serializeFormJSON = function (options) {
options = jQuery.extend({}, options);
var self = this,
json = {},
push_counters = {},
patterns = {
"validate": /^[a-zA-Z][a-zA-Z0-9_]*(?:\[(?:\d*|[a-zA-Z0-9_]+)\])*$/,
@benfavre
benfavre / dos2unix_recursive
Created July 8, 2016 10:36
Recursively replace line ending in linux
find . -type f -print0 | xargs -0 dos2unix
// see : http://superuser.com/questions/757081/how-do-i-convert-all-files-in-a-folder-to-a-different-line-ending-on-windows
@benfavre
benfavre / -README.md
Created February 19, 2016 17:44 — forked from jirutka/-README.md
How to use terminal on Windows and don’t go crazy…

How to use terminal on Windows without going crazy…

Windows is really horrible system for developers and especially for devops. It doesn’t even have a usable terminal and shell, so working with command line is really pain in the ass. If you really don’t want to switch to any usable system (OS X, Linux, BSD…), then this guide should help you to setup somewhat reasonable environment – usable terminal, proper shell, ssh client, git and Sublime Text as a default editor for shell.

Install stuff

  1. Download and install Git for Windows* with:
    • [✘] Use Git from the Windows Command Prompt
  • [✘] Checkout as-is, commit Unix-style line endings
@benfavre
benfavre / league-ubuntu-linux
Created December 29, 2014 22:03
Patch League with tuxlol, for linux ubuntu League of legends
#!/bin/sh
# --- README ---
# Run this patch after every update or the game will crash before loading
# adjust paths if needed
# get tuxlol https://bitbucket.org/Xargoth/tuxlol/downloads
# get mono: apt-get install mono-runtime libmono-system-core4.0-cil
cd ~/.PlayOnLinux/wineprefix/LeagueOfLegends/tuxlol/
mono tuxlol.exe patch --dir ../drive_c/Riot\ Games/League\ of\ Legends/ -- no-backup
@benfavre
benfavre / gravity
Created December 12, 2014 17:46
Gravity forms Less - BOOTSTRAP
.gform_wrapper ul {
.list-unstyled();
}
.gform_wrapper li {
.form-group();
}
.gform_wrapper form {
margin-bottom: 0;
}
.gform_wrapper .gfield_required {
@benfavre
benfavre / eps_to_png.sh
Created September 11, 2014 19:44
Batch EPS to PNG with colorspace conversion croping and centering
for f in *.eps; do echo "Converting $f"; convert -colorspace sRGB $f -density 300 -quality 100% -colorspace rgb -flatten -resize 1200x1000^ -gravity center -crop 1200x1000+0+0 /var/www/suivisalades/public/media/images-produits/png/"$(basename "$f" .eps).png"; done
<?php
// Add custom meta to user profile screen
add_action( 'show_user_profile', 'example_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'example_show_extra_profile_fields' );
function example_show_extra_profile_fields( $user ) { ?>
<h3>Payment information</h3>