Skip to content

Instantly share code, notes, and snippets.

View rickard2's full-sized avatar

Rickard Andersson rickard2

View GitHub Profile
### Keybase proof
I hereby claim:
* I am rickard2 on github.
* I am rickard2 (https://keybase.io/rickard2) on keybase.
* I have a public key whose fingerprint is CD98 AE39 2253 B4FA 0D04 6AC6 1F56 3101 AF1B 6B38
To claim this, I am signing this object:
# /opt/local/apache/conf/extra/php-fpm.conf
#
# Sedan i conf/httpd.conf
#
# Include conf/extra/php-fpm.conf
<Location /www>
Order allow,deny
Allow from all
</Location>
@rickard2
rickard2 / keybase.md
Created September 10, 2015 20:19
keybase.md

Keybase proof

I hereby claim:

  • I am rickard2 on github.
  • I am rickard2 (https://keybase.io/rickard2) on keybase.
  • I have a public key whose fingerprint is 2685 7C90 6346 D5CA 3F1A DE61 9800 5E33 5FB8 2BA1

To claim this, I am signing this object:

@rickard2
rickard2 / gist:1631954
Created January 18, 2012 08:23
Replace urls with links
<?php
/**
* Parse a string and match probable URLs, and replace them with clickable links
* @param $string
* @return string
*/
function create_links($string) {
$pattern = array(
'/(?<![\/"])(https?:\/\/[a-z0-9.\-]+\.[a-z]{2,6}\/?([a-z0-9?=&%#:,.~_+\/\-]+)?)/i',
$email = isset($comment->comment_author_email) ? $comment->comment_author_email : null;
if ( !$email && !is_integer($id_or_email) ) {
$email = $id_or_email;
}
if ( !$email && is_integer($id_or_email) ) {
$user = get_userdata($id_or_email);
$email = $user->user_email;
}
@rickard2
rickard2 / gist:2357953
Created April 11, 2012 08:37
interface
<?php
interface iA {
function a();
}
class Alpha implements iA {
@rickard2
rickard2 / gist:2390740
Created April 15, 2012 07:35
EmberJS Data handling
window.App = Ember.Application.create({});
Item = Ember.Object.extend({
});
App.ListController = Ember.ArrayController.create({
content: [],
currentItem: null,
@rickard2
rickard2 / gist:2499527
Created April 26, 2012 13:24
jQuery and native functions
// Works just fine
$(document).on('click', '#print', function() { window.print() });
// Doesnt work
$(document).on('click', '#print', window.print );
@rickard2
rickard2 / gist:2717746
Created May 17, 2012 09:31
WordPress HTML test
<p>The purpose of this HTML is to help determine what default settings are with CSS and to make sure that all possible HTML Elements are included in this HTML so as to not miss any possible Elements when designing a site.</p>
<hr />
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
<p><small><a href="#wrapper">[top]</a></small></p>
<hr />
RewriteEngine On
RewriteRule .? - [F,L]