Skip to content

Instantly share code, notes, and snippets.

🏠
(在家工作) Working from home

Lasse R LasseRafn

🏠
(在家工作) Working from home
View GitHub Profile
View strip_word_html.php
<?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
View Contract Killer 3.md

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

@LasseRafn
LasseRafn / site.conf
Created Aug 18, 2015
Example Laravel Nginx config to avoid 404-images to be loaded by routes.
View site.conf
...
location ~* \.(gif|jpg|jpeg|ico|png|svg)$ {
# Do jack shit.
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
View keybase.md

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:

View Prestashop1ValetDriver.php
?php
class Prestashop1ValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return boolean
View Prestashop1ValetDriver.php
?php
class Prestashop1ValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return boolean
View how-do-i-even.php
<?php
/*
* Various of other things going on up here. I slimmed down the code for readability,
* and focus. $companies is an array of .. companies .. gathered from an external API.
*/
$companiesToCreate = collect([]);
foreach ( $companies as $company )
{
View how-do-i-even-explained.md

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.

View Csrf.js
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
You can’t perform that action at this time.