Skip to content

Instantly share code, notes, and snippets.

@spaceemotion
spaceemotion / BrowsershotExtended.php
Created June 12, 2022 21:37
Browsershot on Vapor
<?php
declare(strict_types=1);
namespace App\Services\Browsershot;
use RuntimeException;
use Spatie\Browsershot\Browsershot as SpatieBrowsershot;
use Spatie\TemporaryDirectory\TemporaryDirectory;
@spaceemotion
spaceemotion / SetFormValue.ce.vue
Last active January 7, 2022 10:59
setFormValue for CustomElements in Vue3
<template>
<input type="text" v-model="query" />
</template>
<script lang="ts">
import { defineComponent, onMounted, watch, computed, getCurrentInstance, ref } from 'vue'
const useInternals = () => {
const internals = ref<any>();
@spaceemotion
spaceemotion / browser.js
Created July 23, 2020 23:49
Custom Browsershot browser.js to run on AWS Lambda via Laravel Vapor
const chromium = require('chrome-aws-lambda');
const fs = require('fs');
const URL = require('url').URL;
const URLParse = require('url').parse;
const [, , ...args] = process.argv;
/**
* There are two ways for Browsershot to communicate with puppeteer:
@spaceemotion
spaceemotion / DatabaseServiceProvider.php
Created July 22, 2018 20:16
Adds a "chunkSimple" method to Laravel's query builder, so where(Has) clauses don't break with pagination. This might happen if you update the same model in the chunk callback, thus skipping rows. Simply swap out chunk with chunkSimple and hey, presto!
<?php
namespace App\Providers;
use Illuminate\Database\Eloquent\Builder;
class DatabaseServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
@spaceemotion
spaceemotion / _border-utilities.scss
Last active June 4, 2018 18:29
Responsive Border Utilities for Bootstrap 4.1
// stylelint-disable declaration-no-important
//
// Border
//
@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
@spaceemotion
spaceemotion / EditorWindowFinder.cs
Created March 28, 2017 21:08
Displays a window that lists all available EditorWindows inside the Unity Editor.
using System;
using System.Reflection;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class EditorWindowFinder : EditorWindow
{
@spaceemotion
spaceemotion / OcclusionBase.cs
Created December 24, 2016 22:09
Free dynamic (run time) object occlusion scripts (https://www.reddit.com/r/Unity3D/comments/5k1gqv)
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OcclusionBase : MonoBehaviour {
public bool isVisible { get; set; }
public DateTime lastSeen { get; set; }
}
@spaceemotion
spaceemotion / pinterest-classic.css
Created July 28, 2016 00:46
Pinterest "Classic Style" - UserStyle
.UserProfilePage .secretBoardWrapper .Board.boardCoverImage {
background: #fff !important;
}
.Board.boardCoverImage, .Pin.summary:not(.exploreTabPin) {
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.22) !important;
background: #fff !important;
}
.pinCredits {