Skip to content

Instantly share code, notes, and snippets.

View breadthe's full-sized avatar

breadthe

View GitHub Profile
@marcoarment
marcoarment / S3.php
Last active June 18, 2024 14:15
A simple PHP class to perform basic operations against Amazon S3 and compatible services.
<?php
/*
A simple PHP class to perform basic operations against Amazon S3 and compatible
services. Requires modern PHP (7+, probably) with curl, dom, and iconv modules.
Copyright 2022 Marco Arment. Released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@rikschennink
rikschennink / code-macro.njk
Created January 14, 2021 13:40
A macro that generates faux code SVG path elements
{% macro codeline(x, y, totalStatements, spaceWidth) %}
{% set offset = x %}
{% for i in range(0, totalStatements) -%}
{% set width = [2, 4, 8, 12, 24] | random %}
{% set opacity = [0.5, 0.75, 1] | random %}
<path d="M{{ offset }} {{ y }} h{{width}}" opacity="{{ opacity }}"/>
{% set offset = offset + width + spaceWidth %}
{% endfor %}
@joshuat
joshuat / Slack avatar-less sidebar.md
Last active January 19, 2021 08:25
Remove the avatars from your slack sidebar

Slack has listened to feedback and given us a way to toggle off the sidebar avatars.

(This only seems to be available in the Beta channel at the moment)

Display or hide profile photos

  1. From your desktop, click your profile picture in the top right.
  2. Select Preferences from the menu.
  3. Click Sidebar in the left-side column.
  4. Check or uncheck the boxes next to Show profile photos next to DMs.
@Gummibeer
Gummibeer / SignInController.php
Last active September 2, 2020 03:57
Laravel ThrottlesRequests trait
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Concerns\ThrottlesRequests;
use App\Http\Requests\Auth\SignInRequest;
use App\Http\Requests\Auth\SignUpRequest;
use App\Models\User;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\RedirectResponse;
@mpociot
mpociot / tinker
Last active March 21, 2024 18:30
Python script to open Tinkerwell from your current working directory - tinkerwell.app
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
RUN_PATH = '/Applications/Tinkerwell.app'
def process_args(argv):
args = []
@paulredmond
paulredmond / HMACRequestHandler.php
Created April 7, 2017 05:43
Example Guzzle HTTP Middleware for a simple HMAC Authorization
<?php
namespace App;
use Carbon\Carbon;
use Psr\Http\Message\RequestInterface;
class HMACRequestHandler
{
private $key;
@w00fz
w00fz / sphp.sh
Last active February 7, 2022 00:12
PHP switcher
#!/bin/bash
# Check if command was ran as root.
if [[ $(id -u) -eq 0 ]]; then
echo "The command \"sphp\" should not be executed as root or via sudo directly."
echo "When a service requires root access, you will be prompted for a password as needed."
exit 1
fi
# Usage
@jherax
jherax / filterArray.js
Last active May 6, 2024 09:35
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@whitingx
whitingx / meta-tags.md
Created October 5, 2012 16:41 — forked from kevinSuttle/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>