Skip to content

Instantly share code, notes, and snippets.

View jeystaats's full-sized avatar
🏠
Working from home

Jasper Staats jeystaats

🏠
Working from home
View GitHub Profile
@jeystaats
jeystaats / push-to-redis-queue-laravel.ts
Last active October 3, 2022 12:39
Add to Laravel Queue (Redis) from NodeJS [Laravel > 9 )
import { createClient } from 'redis';
import { serialize } from 'php-serialize';
const RedisClient = createClient();
export class Job {
job = null;
connection = null;
queue = null;
chainConnection = null;
@jeystaats
jeystaats / insomnia-sync-script.sh
Created February 11, 2020 14:21
Sync insomnia locally
echo "Copying insomnia settings"
files=("Settings" "Workspace" "Request" "RequestGroup" "RequestMeta" "RequestGroupMeta" "WorkspaceMeta" "Stats" "RequestVersion")
# Look for signs of trouble in each log
for i in ${!files[@]};
do
file=${files[$i]}
cp /Users/USERNAME/Library/'Application Support'/Insomnia/insomnia.${file}.db ~/Projects/insomnia/insomnia.${file}.db
@jeystaats
jeystaats / insomnia-sync-script.sh
Created February 11, 2020 14:21
Sync insomnia locally
echo "Copying insomnia settings"
files=("Settings" "Workspace" "Request" "RequestGroup" "RequestMeta" "RequestGroupMeta" "WorkspaceMeta" "Stats" "RequestVersion")
# Look for signs of trouble in each log
for i in ${!files[@]};
do
file=${files[$i]}
cp /Users/USERNAME/Library/'Application Support'/Insomnia/insomnia.${file}.db ~/Projects/insomnia/insomnia.${file}.db
@jeystaats
jeystaats / gist:88ec4fa505d2a34caf2602c5da2cf805
Created February 9, 2020 11:25
Regex for detecting criminal names
[A-Z]+[a-zA-Z^\p{L}\p{M}]++\s[a-zA-Z]\.\s
<scheme name="Staatstheme" version="142" parent_scheme="Darcula">
<metaInfo>
<property name="created">2019-10-21T12:57:27</property>
<property name="ide">PhpStorm</property>
<property name="ideVersion">2017.3.2.0.0</property>
<property name="modified">2019-10-21T12:57:36</property>
<property name="originalScheme">Staatstheme</property>
</metaInfo>
<colors>
<option name="CARET_COLOR" value="ffffff" />
@jeystaats
jeystaats / stresstest.js
Created June 11, 2018 15:40
XHR Stresstest
var change = 0;
var simultanius = 0;
var que = 1000; // number of tests
Array(que).join(0).split(0).forEach(function(a,i){
var xhr = new XMLHttpRequest;
xhr.open("GET",'/?' + i); // cacheBust
xhr.onreadystatechange = function() {
if(xhr.readyState == 2){
@jeystaats
jeystaats / valet-fetch.sh
Created July 19, 2017 20:07
Valet URL to .env file automatically
#!/bin/bash
export var=`valet fetch-share-url`
sed -i -e "s@.*APP_URL.*@APP_URL=$var@" $result
echo "💪 - Valet share URL has been replaced 📋 "
@jeystaats
jeystaats / functionality.php
Last active February 25, 2017 12:06
Laravel send slack notification
<?php
$this->notification('Nieuw bericht', 'Er is een nieuw bericht :ghost:', config('slack.color'),
[
'title' => "Veld 1",
'value' => 'Dingen',
'short' => true,
], [
'title' => "Veld 2",
'value' => 'Nog meer dingen',
@jeystaats
jeystaats / DiffCollection.php
Last active February 25, 2017 11:34
Difference in Collection ( Laravel )
<?php
$array1 = ['Rocket','Thruster','Space'];
$array2 = ['Rocket','Rocks','Space'];
$collection = collect($array1);
$intersect = $collection->intersect($array2);
var_dump($intersect )
// $intersect = ['Rocket','Space'];
public toSeconds(time) {
var parts = time.split(':');
return (+parts[0]) * 60 * 60 + (+parts[1]) * 60 + (+parts[2]);
}