Skip to content

Instantly share code, notes, and snippets.

<?php
# Insert code here
@LasseRafn
LasseRafn / site.conf
Created August 18, 2015 21:28
Example Laravel Nginx config to avoid 404-images to be loaded by routes.
...
location ~* \.(gif|jpg|jpeg|ico|png|svg)$ {
# Do jack shit.
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

<?php
function strip_word_html($text, $allowed_tags = '<b><i><sup><sub><em><strong><u><br>')
{
mb_regex_encoding('UTF-8');
//replace MS special characters first
$search = array('/&lsquo;/u', '/&rsquo;/u', '/&ldquo;/u', '/&rdquo;/u', '/&mdash;/u');
$replace = array('\'', '\'', '"', '"', '-');
$text = preg_replace($search, $replace, $text);
//make sure _all_ html entities are converted to the plain ascii equivalents - it appears
//in some MS headers, some html entities are encoded and some aren't

Keybase proof

I hereby claim:

  • I am lasserafn on github.
  • I am lasserafn (https://keybase.io/lasserafn) on keybase.
  • I have a public key whose fingerprint is B54C 53C9 15E8 5C4B 335D 976D 0F94 580B EDF0 565E

To claim this, I am signing this object:

?php
class Prestashop1ValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return boolean
?php
class Prestashop1ValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return boolean

Okay, so basically what I'm trying to do, is gather Companies and Employees from an external API. For the purpose of this, I'll call the API objects:

  • Companies = extCompanies
  • Employees = extEmployees

In my database, I also have Companies and Employees. I'll name them

  • Companies = intCompanies
  • Employees = intEmployees

Basically, I need to sync the external data, with the internal.

Vue.http.headers.common['X-CSRF-TOKEN'] = Laravel.csrfToken;
Vue.http.interceptors.push((request, next) => {
request.headers.set('X-CSRF-TOKEN', Laravel.csrfToken);
next();
});
// I tried both of these approaches (even at the same time??)
// It even sends the token with the request, yet it still fails
<?php
class UniqueId {
private $id;
public function __construct($prefix = '')
{
$this->id = uniqid($prefix, true);
}