Skip to content

Instantly share code, notes, and snippets.

View Ma-ve's full-sized avatar

Wesley Ma-ve

  • The Netherlands
View GitHub Profile
@Ma-ve
Ma-ve / addressRegex.php
Created August 10, 2018 10:46
Nederlandse / Duitse adres regex
<?php
/**
* @param string $value
* @param int $index
*
* @return null|string
*/
private function addressRegex($value, $index) {
preg_match("/^(\d*[\wäáàâåëéèêïíìîöóòôüúùûýÿÄÁÀÂËÉÈÊÏÍÌÎÖÓÒÔÜÚÙÛÝßñÑÇçšæÆ\d '\/\-\.]+)[,\s]+(\d+)\s*([\wäáàâåëéèêïíìîöóòôüúùûýÿÄÁÀÂËÉÈÊÏÍÌÎÖÓÒÔÜÚÙÛÝßñÑÇçšæÆ\d\-\/]*)$/", $value, $data);
@Ma-ve
Ma-ve / stripped.php
Created June 30, 2018 18:32
redditdev
<?php
<?php
$provider = new \Rudolf\OAuth2\Client\Provider\Reddit([
'clientId' => env('REDDIT_CLIENT_ID'),
'clientSecret' => env('REDDIT_CLIENT_SECRET'),
'redirectUri' => 'mydomain.com/callback',
'userAgent' => 'mydomain:1:' . date('Ymd') . ', (by /u/Mavee)',
'scopes' => ['identity read',],
@Ma-ve
Ma-ve / helper.js
Created June 18, 2018 08:01
[JS] DossierItem LinkedTo based on list of array of external ids
function getLinkedToInfoByArrayOfIds(ids) {
if(ids.length < 1) {
return [];
}
var group = {
'person' : 'relation',
'organization' : 'relation',
'project' : 'project',
'sales' : 'sales'
};
@Ma-ve
Ma-ve / helper.php
Last active June 15, 2018 16:23
DossierItem LinkedTo based on list of array of external ids
<?php
/**
* @param array $ids
*
* @return array
*/
private function getLinkedToInfoByArrayOfIds($ids) {
if(empty($ids)) {
return [];
}