Skip to content

Instantly share code, notes, and snippets.

View khlbrg's full-sized avatar
💭
Working

Andreas Kihlberg khlbrg

💭
Working
View GitHub Profile
@khlbrg
khlbrg / gist:9724368
Created March 23, 2014 15:13
Create an alias for composer running hhvm
alias composer='hhvm /usr/local/bin/composer'
@khlbrg
khlbrg / gist:8051282
Created December 20, 2013 06:51
Remove 301 redirect loop on Wordpress on Nginx
location / {
try_files $uri $uri/ /index.php?q=$uri$is_args&$args;
}
//in functions.php in theme
add_filter( 'got_rewrite', '__return_true' );
@khlbrg
khlbrg / gist:8436191
Last active January 3, 2016 08:29
Make surf CSRF is checked on eash post request on Laravel Controllers
class BaseController extends Controller {
public function __construct()
{
// CSRF protection for all POST requests
$this->beforeFilter('csrf', array('on' => 'post'));
}
}
@khlbrg
khlbrg / functions.php
Last active March 15, 2016 20:53
Specify custom post types by code
function my_custom_tpa() {
$labels = array(
'name' => _x( 'TPA', 'tpa' ),
'singular_name' => _x( 'TPA', 'tpa' ),
'add_new' => _x( 'Add New', 'book' ),
'add_new_item' => __( 'Add New TPA' ),
'edit_item' => __( 'Edit TPA' ),
'new_item' => __( 'New TPA' ),
'all_items' => __( 'All TPA' ),
'view_item' => __( 'View TPA' ),
@khlbrg
khlbrg / install.md
Last active April 2, 2016 19:53 — forked from zaherg/install.md
Creating Your Laravel & nginx Server

Creating Your Laravel & nginx Server

updating your system

	apt-get update && apt-get upgrade
	adduser [username]
	usermod -aG sudo [username]
	apt-get -y install git

Now you will have to logout then you need to login using the user you create

@khlbrg
khlbrg / index.php
Last active April 4, 2016 17:34
My public gist
<php echo phpinfmmmm,m,m,m,mo()); ?>ffdsfsjjkjk
@khlbrg
khlbrg / index.html
Last active April 4, 2016 19:31
Check if isEditing
var a = document.createElement('a');
a.href = window.location.href;
if (a.search.indexOf('isEditing=true') !== -1) {
}
@khlbrg
khlbrg / main.swift
Last active April 5, 2016 19:27
Open a url from a Swift app with NSWorksspace
NSWorkspace.sharedWorkspace().openURL(url)
@khlbrg
khlbrg / functions.php
Last active April 11, 2016 11:37
Easy way to be able to send mail with SMTP in Wordpress.
add_action('phpmailer_init','send_smtp_email');
function send_smtp_email( $phpmailer )
{
// Define that we are sending with SMTP
$phpmailer->isSMTP();
// The hostname of the mail server
$phpmailer->Host = "smtp.example.com";
// Use SMTP authentication (true|false)