Skip to content

Instantly share code, notes, and snippets.

View frumbert's full-sized avatar

TIm St.Clair frumbert

View GitHub Profile
@idleberg
idleberg / vscode-macos-context-menu.md
Last active February 23, 2024 22:58
“Open in Visual Studio Code” in macOS context-menu
View vscode-macos-context-menu.md

Open in Visual Studio Code

  • Open Automator
  • Create a new document
  • Select Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
    • your default shell should already be selected, otherwise use /bin/zsh for macOS 10.15 (”Catalina”) or later
    • older versions of macOS use /bin/bash
  • if you're using something else, you probably know what to do 😉
@lennardv2
lennardv2 / 1. Building PHP-MAMP on Apple Silicon M1.md
Last active February 29, 2024 07:57
Native PHP development / MAMP stack on Apple silicon M1
View 1. Building PHP-MAMP on Apple Silicon M1.md

Building the MAMP stack (php, apache & mysql) on Apple Silicon ARM (native)

Update! This tutorial is outdated. Nowadays brew installes m1 binaries just fine. Also use valet: https://laravel.com/docs/9.x/valet. It's 10x easier.

In this tutorial, we'll build the the nescessary packages for ARM via homebrew. After that we'll configure apache2 for using virtual hosts. The native php is ofcourse way faster, see the results of this benchmark below.

TEST NAME SECONDS OP/SEC
@TETYYS
TETYYS / brian.md
Last active February 9, 2024 03:44
All Brian TTS characters
View brian.md
Character code (character) Duration (ms) Alias to Pronounced as
27 (�) 656 None Escape
33 (!) 1333 None Exclamation mark
35 (#) 409 None Hash
36 ($) 425 None Dollar
37 (%) 631 None Percent
38 (&) 329 None And
43 (+) 396 None Plus
45 (-) 706 None Dash
@nicolasdao
nicolasdao / webpack.md
Last active July 28, 2023 19:15
Basic damn Webpack config for simple transpilation ES6 to ES5
View webpack.md

Install

npm install -D acorn babel-loader @babel/core @babel/preset-env babel-polyfill webpack webpack-cli uglifyjs-webpack-plugin --save-dev

webpack-cli and acorn are dependencies that you, unfortunately, have to install if you want to run this god damn thing without any obscure warnings or errors.

Build

Configure Webpack

@Oranzh
Oranzh / AES-256 encryption and decryption in PHP and C#.md
Created March 24, 2018 04:19
AES-256 encryption and decryption in PHP and C#
View AES-256 encryption and decryption in PHP and C#.md

AES-256 encryption and decryption in PHP and C#

Update: There is a more secure version available. Details

PHP

<?php

$plaintext = 'My secret message 1234';
@gdestree
gdestree / dnsmasq-setup.md
Created December 18, 2017 19:48
Setup dnsmasq on OS X *updated for .test
View dnsmasq-setup.md

Never touch your local /etc/hosts file in OS X again

UPDATED for .test

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

@paceaux
paceaux / attribute-promise.js
Created June 16, 2017 21:11
A promise that can be set on an element, to resolve when that element's attributes have changed
View attribute-promise.js
** AttrPromise
* @param {element} DOM element. required
* @param {attributeName} String. Optional. Attribute that is expected to change.
* @param {rejectTime} Int. Optional. Seconds (not ms) to wait before rejecting. 0 means there is no reject time.
* @returns {promise}
*/
function attrPromise(element, attributeName,rejectTime = 0) {
return new Promise((resolve,reject) => {
let hasChanged = false;
@remarkablemark
remarkablemark / draggable-example.js
Created December 17, 2016 04:13
Basic draggable example using vanilla JavaScript.
View draggable-example.js
'use strict';
/**
* Makes an element draggable.
*
* @param {HTMLElement} element - The element.
*/
function draggable(element) {
var isMouseDown = false;
@pqina
pqina / create-thumbnail.php
Last active June 29, 2023 18:13
Create thumbnails with PHP
View create-thumbnail.php
<?
// Link image type to correct image loader and saver
// - makes it easier to add additional types later on
// - makes the function easier to read
const IMAGE_HANDLERS = [
IMAGETYPE_JPEG => [
'load' => 'imagecreatefromjpeg',
'save' => 'imagejpeg',
'quality' => 100
@mpkliewer
mpkliewer / xapi-storyline-basic-instructions.md
Last active February 2, 2023 22:25
Simple example of pulling xAPI results from LRS in an Articulate Storyline project
View xapi-storyline-basic-instructions.md

Basic Instructions

  1. Copy the Script1 function into the first Storyline JS trigger on the page you wish to display results
    • Repeat for Scripts 2 and 3
    • Tweak as necessary to get different results
  2. Create a Storyline variable to hold the results
    • Just called “storylineVar” in the example
  3. Insert a “reference” to this variable on the screen (%storylineVar%)
  4. Publish
    • Doesn’t have to be “TinCan” publish since we’re handling it ourselves
  5. Add the “tincan.js” library to the root folder of your published output