Skip to content

Instantly share code, notes, and snippets.

View juukie's full-sized avatar

Jürgen juukie

  • Active Creations
  • Netherlands
View GitHub Profile
@juukie
juukie / Middleware-CSP.php
Created May 1, 2023 08:24 — forked from valorin/Middleware-CSP.php
CSP Middleware - the simple CSP middleware I use across all of my projects.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Vite;
use Illuminate\Support\Str;
/**
* Simple Content Security Policy middleware.
@juukie
juukie / download.js
Created December 3, 2021 11:31 — forked from maryo/download.js
Typekit font downloader
const https = require('https');
const fs = require('fs');
// https://github.com/majodev/google-webfonts-helper/blob/master/server/logic/conf.js
const FORMAT_USER_AGENTS = {
// see http://www.dvdprojekt.de/category.php?name=Safari for a list of sample user handlers
// test generation through running grunt mochaTest:src
eot: 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)',
woff: 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0',
// must serve complete woff2 file for one variant (no unicode range support yet!)
@juukie
juukie / JsColor.vue
Created September 8, 2021 11:26 — forked from niveshsaharan/JsColor.vue
Vue.js Component for http://jscolor.com/
<template>
<div class="input-control color-input">
<input :value="value"
:id="id"
class="jscolor-input {hash:true,styleElement:'',onFineChange:'jsColorOnFineChange(this)'}"
@change="onChange($event.target)"
@input="onChange($event.target)"
@focus="showColorPicker"
@onFineChange="onFineChange"
ref="color_input"
@juukie
juukie / package.json.js
Created November 20, 2020 14:50 — forked from MoOx/package.json.js
Boost your Webpack performance with DLLPlugin (will bundle as dll all your "dependencies", see comment in package.json)
{
"private": true,
// ...
"#dependencies": "dependencies are the one shipped to the client",
"dependencies": {
"babel-polyfill": "^6.7.4",
"react": "^15.0.0",
// ...
"whatwg-fetch": "^0.11.1"
},
<?php
/**
* @param $object
* @return array|string
*/
function simplexml_to_array($object) {
if (! is_object($object)) {
return $object;
}
@juukie
juukie / promise.finally.polyfill.js
Created February 27, 2019 09:49 — forked from spiralx/promise.finally.polyfill.js
Polyfill to add a finally() method to the Promise object
Promise.prototype.finally = function (callback) {
return this.then(
value => this.constructor.resolve(callback()).then(() => value),
reason => this.constructor.resolve(callback()).then(() => { throw reason })
)
}
import React from 'react-native'
var {
Image,
Animated,
View
} = React
module.exports = React.createClass({
getInitialState() {
@juukie
juukie / valet-part-2.sh
Created November 29, 2018 15:08 — forked from rcubitto/valet-part-2.sh
Configure subdomains in Laravel Valet - Part 2
cd ~/.valet/Sites
ln -s example api.example
@juukie
juukie / _bootstrap-sass-xl.scss
Last active August 7, 2018 08:33
Add xl step to bootstrap sass. Should be after bootstrap.scss.
/* Place this after bootstrap.scss */
$screen-xl: 1560px !default;
$screen-xl-min: $screen-xl !default;
$screen-xl-desktop: $screen-xl-min !default;
$screen-lg-max: ($screen-xl-min - 1) !default;
$container-xlarge-desktop: (1530px + $grid-gutter-width) !default;
$container-xl: $container-xlarge-desktop !default;
.container {
@juukie
juukie / macro.php
Created November 7, 2017 08:02
Laravel social media url macro
<?php
URL::macro('social', function ($name, $replacement = '#') {
return array_get([
'facebook' => 'https://www.facebook.com/mypage/',
'instagram' => 'https://www.instagram.com/mypage/',
'pinterest' => 'https://nl.pinterest.com/mypage/',
], $name), $replacement);
});