Skip to content

Instantly share code, notes, and snippets.

Avatar
🐼
beary busy

Tom Witkowski Gummibeer

🐼
beary busy
View GitHub Profile
@Gummibeer
Gummibeer / index.html
Last active Sep 10, 2019
Tailwind Admin Dashboard Template
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Tailwind Admin Dashboard</title>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
</head>
@Gummibeer
Gummibeer / gif2mp4.sh
Last active May 10, 2019
ffmpeg snippets
View gif2mp4.sh
#!/bin/bash
function error_exit {
echo "$1" >&2 ## Send message to stderr. Exclude >&2 if you don't want it that way.
exit "${2:-1}" ## Return a code specified by $2 or 1 by default.
}
if [ $# -eq 0 ]; then
error_exit "No input filepath given"
fi
View injector_7603c867188e487138db3c255dbac9f0.js
function waitForElement(selector) {
return new Promise(function(resolve, reject) {
var runs = 1;
var interval = setInterval(function() {
if (runs >= 30) {
clearInterval(interval);
reject(new Error('max runs exceeded'));
}
var el = document.querySelector(selector);
@imfing
imfing / dynamic_svg.md
Last active Apr 22, 2021
Using inline SVGs in Vue components
View dynamic_svg.md

An alternative way to implement "dynamic" svg is using html-loader.

First, create a component for svg, SvgIcon.vue:

<template>
  <div v-html="require(`../../assets/icon-${icon}.svg`)"></div>
</template>

<script>
export default {
@Gummibeer
Gummibeer / git_delete_untracked_branches.sh
Last active Jun 19, 2020
git_delete_untracked_branches.sh
View git_delete_untracked_branches.sh
# EN
git checkout master && git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
# DE
git checkout master && git fetch -p && git branch -vv | awk '/: entfernt]/{print $1}' | xargs git branch -D
@Gummibeer
Gummibeer / ecosia_bot.js
Last active Dec 4, 2017
This script plants trees by botting Ecosia search
View ecosia_bot.js
Array.prototype.random = function() {
return this[Math.floor(Math.random() * this.length)];
};
var properties = [
'car',
'house',
'phone',
'money'
];
@devmycloud
devmycloud / ParseInputStream.php
Last active Aug 29, 2022
Process php://input to get multipart/form-data parameters for PATCH API request
View ParseInputStream.php
<?php
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* stream - Handle raw input stream
*
* LICENSE: This source file is subject to version 3.01 of the GPL license
* that is available through the world-wide-web at the following URI:
@deividaspetraitis
deividaspetraitis / lumen-filesystem.md
Created Oct 19, 2017
Lumen flysystem ( filesystem ) integration
View lumen-filesystem.md

Lumen flysystem integration

By default lumen doesn't support laravel file system. In order to integrate to lumen we need follow these instructions:

  1. composer require league/flysystem
  2. Copy filesystems config file from Laravel ( https://github.com/laravel/laravel/blob/master/config/filesystems.php ) to your local Lumen installation document_root/config
  3. Bind filesystem to IoC for example in document_root/bootstrap/app.php by adding this code lines:

`` $app->singleton('filesystem', function ($app) {

@thomasjsn
thomasjsn / ElasticRecreateIndex.php
Created Feb 13, 2017
Laravel console command for reindexing Elasticsearch.
View ElasticRecreateIndex.php
<?php
namespace App\Console\Commands;
use Elasticsearch\ClientBuilder;
use Illuminate\Console\Command;
class ElasticRecreateIndex extends Command
{
/**
@jstott
jstott / paginated.js
Created Jan 14, 2017
lodash paginated items
View paginated.js
function getPaginatedItems(items, page, pageSize) {
var pg = page || 1,
pgSize = pageSize || 100,
offset = (pg - 1) * pgSize,
pagedItems = _.drop(items, offset).slice(0, pgSize);
return {
page: pg,
pageSize: pgSize,
total: items.length,
total_pages: Math.ceil(items.length / pgSize),