View Middleware-CSP.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Support\Facades\Vite; | |
use Illuminate\Support\Str; | |
/** | |
* Simple Content Security Policy middleware. |
View download.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!) |
View JsColor.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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" |
View package.json.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
}, |
View simplexml_to_array.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param $object | |
* @return array|string | |
*/ | |
function simplexml_to_array($object) { | |
if (! is_object($object)) { | |
return $object; | |
} |
View promise.finally.polyfill.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Promise.prototype.finally = function (callback) { | |
return this.then( | |
value => this.constructor.resolve(callback()).then(() => value), | |
reason => this.constructor.resolve(callback()).then(() => { throw reason }) | |
) | |
} |
View FadeInImage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react-native' | |
var { | |
Image, | |
Animated, | |
View | |
} = React | |
module.exports = React.createClass({ | |
getInitialState() { |
View valet-part-2.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/.valet/Sites | |
ln -s example api.example |
View macro.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
}); |
View takeAtLeast.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add takeAtLeast method to Promise | |
/* eslint no-unused-vars: 0 */ | |
Promise.prototype.takeAtLeast = function (time) { | |
return new Promise((resolve, reject) => { | |
const limiter = new Promise((resolve, reject) => { | |
setTimeout(resolve, time); | |
}) | |
Promise.all([this, limiter]).then(([response, _]) => { | |
resolve(response) |
NewerOlder