Skip to content

Instantly share code, notes, and snippets.

View ngnguyen1's full-sized avatar
🏠
Working from home

Nga Nguyen ngnguyen1

🏠
Working from home
  • FPT - Silicon Labs
  • Hà Nội
  • 03:26 (UTC +07:00)
  • LinkedIn in/nga-nguyen
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:
@gmazzap
gmazzap / Custom_Reg.php
Last active April 22, 2024 12:16
Just a rough plugin example to answer a WPSE question: How to display Wordpress User Registration Form in front-end of the website?
<?php
namespace Custom_Reg;
class Custom_Reg {
protected $form;
protected $saver;
function __construct( Form $form, Saver $saver ) {
@nateware
nateware / make_favicon.sh
Last active June 27, 2024 16:02
Imagemagick to create favicon.ico with 16x16 and 32x32 sizes in it
# IE is still braindead so still use favicon.ico
convert -resize x16 -gravity center -crop 16x16+0+0 -flatten -colors 256 input.png output-16x16.ico
convert -resize x32 -gravity center -crop 32x32+0+0 -flatten -colors 256 input.png output-32x32.ico
convert output-16x16.ico output-32x32.ico favicon.ico
# Then, HTML needs to specify size="XxY" as largest size due to browser bugs
<link rel="shortcut icon" href="/favicon.ico" sizes="32x32">
@rnwolf
rnwolf / spacemacs-keybindings.md
Last active February 24, 2024 08:45 — forked from kiambogo/spacemacs-keybindings
spacemacs keybindings that i need to learn