Skip to content

Instantly share code, notes, and snippets.

View FerrielMelarpis's full-sized avatar
💭
Working

Ferriel Melarpis FerrielMelarpis

💭
Working
View GitHub Profile
@FerrielMelarpis
FerrielMelarpis / magicfn.ahk
Last active September 21, 2022 16:55
Anne Pro 2 Magic Fn Like Behavior Example
; The idea is simple, turn off capslock and use it as FN key (sort of)
; Setup a hook to override the default event the capslock key will send.
; Then listen to press duration e.g. 0.5s
; When the press is longer than 0.5s, the capslock key will function as a modifier
SetCapsLockState, AlwaysOff
$CapsLock::
Keywait, Escape, T0.5
If ErrorLevel
{
<?php
class InvalidValueException extends InvalidArgumentException {
public function __construct( $value, $class ) {
$message = sprintf( '%s is not an acceptable value for "%s" enum.', json_encode( $value ), $class );
parent::__construct( $message );
}
}
@FerrielMelarpis
FerrielMelarpis / function.php
Created December 20, 2018 02:40 — forked from mattclements/function.php
Wordpress Disable Comments (add to function.php)
<?php
// Add to existing function.php file
// Disable support for comments and trackbacks in post types
function df_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ($post_types as $post_type) {
if(post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
@FerrielMelarpis
FerrielMelarpis / ComponentPattern.php
Last active December 17, 2018 06:30
Component Design PHP
<?php
interface Displayable {
public function display();
}
class ArticleCardProps {
protected $thumbnailComponent;
@FerrielMelarpis
FerrielMelarpis / config
Last active August 15, 2018 15:46
Configuring multiple ssh accounts for multiple git accounts (GitHub,GitLab,etc.)
# ~/.ssh/config
# Account 1
Host host1
HostName github.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_host1
# Account 2
Host host2
@FerrielMelarpis
FerrielMelarpis / token-generator.js
Created February 7, 2018 07:35 — forked from ziluvatar/token-generator.js
Example of refreshing tokens with jwt
/**
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
*
* I create this gist just to help those who want to auto-refresh JWTs.
*/
const jwt = require('jwt');

This describes the steps required to configure multiple PHP versions on your development system, if you have issue using the AUR package. Normally one may install the AUR package on a custom path, .e.g, /usr/local/php, but if you are like me having some issues with that you might want to try a custom compile.

Pay attention to step 6) as this is where any required extensions are enabled. For this setup we generally need pdo and mysql extensions.


  1. Download PHP version 5.3.13 (or any version that you are interested in) from http://php.net/releases/

  2. Download the php53 AUR package from https://aur.archlinux.org/packages/php53/

@FerrielMelarpis
FerrielMelarpis / arch-linux-install
Created October 8, 2017 05:16 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@FerrielMelarpis
FerrielMelarpis / Errors.js
Last active September 15, 2017 03:40
OOP Vue
// lib/Errors.js
import _ from 'lodash';
export default class Errors {
constructor() {
this.errors = {};
}
has(field) {
return _.has(this.errors, field);

Keybase proof

I hereby claim:

  • I am ferrielmelarpis on github.
  • I am ferrielmelarpis (https://keybase.io/ferrielmelarpis) on keybase.
  • I have a public key ASBq-wf7J840S5NRd3-JlalbihsgDxbdvpd-qlEgURp-xQo

To claim this, I am signing this object: