Skip to content

Instantly share code, notes, and snippets.

View hakimzulkufli's full-sized avatar
💭
I may be slow to respond.

Hakim Zulkufli hakimzulkufli

💭
I may be slow to respond.
View GitHub Profile
@jonleighton
jonleighton / base64ArrayBuffer.js
Last active June 19, 2024 13:39
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
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 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@kendellfab
kendellfab / goto-sublime
Created August 1, 2013 20:53
Add mouse click `goto definition` in sublime text 3.
Linux - create "Default (Linux).sublime-mousemap" in ~/.config/sublime-text-3/Packages/User
Mac - create "Default (OSX).sublime-mousemap" in ~/Library/Application Support/Sublime Text 3/Packages/User
Win - create "Default (Windows).sublime-mousemap" in %appdata%\Sublime Text 3\Packages\User
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
@vibgy
vibgy / fcm-data-message-service-worker.js
Last active January 20, 2022 16:08
Angular Service and Service Worker Code to handle FCM data messages and to enable a click handler for notifications shown using showNotification
//
// serviceWorkerService.js
//
'use strict';
angular.module('myApp.serviceWorker', [])
.service('serviceWorkerService', ['$q', '$http', '$location', '$timeout',
function($q, $http, $location, $timeout) {
var noTokenError = new Error('No Instance ID token available');
var noPermissionError = new Error('Unable to get permission to notify');
@cryzed
cryzed / fix-infinality.md
Last active June 24, 2024 02:24
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!

Screenshots

Results after following the guide as of 11.01.2017 13:08:

@MatthieuScarset
MatthieuScarset / .lando.yml
Last active January 4, 2024 15:03
Correct settings for XDebug + VSCode + Lando (+3.0)
# Lando version is at least +3.0
name: drupal-nine
recipe: drupal9
services:
appserver:
webroot: web
xdebug: debug
config:
php: .vscode/php.ini
@BenSampo
BenSampo / deploy.sh
Last active July 16, 2024 07:53
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@mfcodeworks
mfcodeworks / encrypted-storage.js
Last active August 3, 2023 05:08
Encrypted storage with localstorage
// Constants
const passphrase = 'password',
key = 'data',
object = { foo: 'bar' };
// Log original item
console.log('Original object', object);
// Store item with encryption
setItem(key, object, passphrase);
// ==UserScript==
// @name No YouTube Volume Normalization
// @namespace https://gist.github.com/abec2304
// @match https://www.youtube.com/*
// @grant none
// @version 2.1
// @author abec2304
// @description Enjoy YouTube videos at their true volume
// @inject-into content
// @run-at document-start
@johnfedoruk
johnfedoruk / clamd-setup.md
Last active June 26, 2024 16:12
Setting up ClamAV

ClamAV Setup Notes

Context

ClamAV can be used in a few different ways. Most importantly, it provides the ability to scan files in realtime (on-access) or to scan the file system periodically.

I tried configuring ClamAV to both perform on-access virus scanning and to perform nightly full filesystem scanning. Using the on-access option did not prove to be very useful, however a scheduled full system scan seems to be of value.

Here is my story.

@conartist6
conartist6 / index.js
Last active June 12, 2022 11:32
sync vs async for loops
function* range(end) {
for (let i = 0; i < end; i++) {
yield i;
}
}
const a = Array.from(range(65536));
module.exports['for await..of values from one chunk'] = {
fn: async function(deferred) {