Skip to content

Instantly share code, notes, and snippets.

View fullstackadam's full-sized avatar

Adam McMahon fullstackadam

  • Raleigh, NC
View GitHub Profile
@domenic
domenic / promises.md
Last active November 19, 2024 02:40
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@gibbs
gibbs / currency_symbols.php
Last active August 31, 2024 03:16
An array of currency symbols as HTML entities
<?php
$currency_symbols = array(
'AED' => '&#1583;.&#1573;', // ?
'AFN' => '&#65;&#102;',
'ALL' => '&#76;&#101;&#107;',
'AMD' => '',
'ANG' => '&#402;',
'AOA' => '&#75;&#122;', // ?
'ARS' => '&#36;',
'AUD' => '&#36;',
@kgodard
kgodard / gist:5072573
Last active December 25, 2023 04:54
how to print avery labels with only a .csv and a web browser

NOTE: DO AVERY LABEL IMPORT STUFF IN FIREFOX -- I DON'T THINK THE AVERY SITE IS COMPATIBLE WITH CHROME

Steps described in this document:

  • Edit and sort your labels file in Google Docs (not in Excel)
  • Download your data as a .csv file
  • Import your edited .csv file into the Avery label maker site (not using Excel)
  • Print labels

  1. Edit and Sort label data in Google Docs
@hunterhector
hunterhector / emoticons
Last active November 9, 2022 04:18 — forked from Digo/emoticons
I used these emoticons to decorate my bash via this script: https://gist.github.com/hunterhector/e8befc2d0bfe636bee56
(´・ω・`)
(˘❥˘)
(・ิω・ิ)
(。▰‿‿▰。) ❤
( ・ิω・ิ)ノิ
Z(∩3∩)Z
o( ̄ヘ ̄o#).
╰(*°▽°*)╯
ʅ(‾◡◝)ʃ
ʕ •ᴥ•ʔ
@azadisaryev
azadisaryev / convertExcel2Sheets
Last active March 9, 2024 18:23
Google Apps Script for converting Excel (.xls or .xlsx) file to Google Spreadsheet. Drive API must be enabled in your script's Advanced Google Services and in Developers Console for the script to work (see https://developers.google.com/apps-script/guides/services/advanced#enabling_advanced_services for details).
/**
* Convert Excel file to Sheets
* @param {Blob} excelFile The Excel file blob data; Required
* @param {String} filename File name on uploading drive; Required
* @param {Array} arrParents Array of folder ids to put converted file in; Optional, will default to Drive root folder
* @return {Spreadsheet} Converted Google Spreadsheet instance
**/
function convertExcel2Sheets(excelFile, filename, arrParents) {
var parents = arrParents || []; // check if optional arrParents argument was provided, default to empty array if not
@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active December 5, 2024 16:45
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@w0rldart
w0rldart / iso8601.php
Created September 12, 2015 12:31
ISO 8601 to seconds
/**
* Convert ISO 8601 values like PT15M33S
* to a total value of seconds.
*
* @param string $ISO8601
*/
function ISO8601ToSeconds($ISO8601)
{
preg_match('/\d{1,2}[H]/', $ISO8601, $hours);
preg_match('/\d{1,2}[M]/', $ISO8601, $minutes);
@coinsandsteeldev
coinsandsteeldev / dialog.html
Last active September 8, 2024 11:18 — forked from arthurattwell/dialog.html
Google Sheets script to allow multi-select in cells with data-validation (adapted from https://www.youtube.com/watch?v=dm4z9l26O0I)
<!DOCTYPE html>
<html>
<head>
<script>
var data
var formId = 'form'
function drawForm() {
if (!data) return
var outputEl = document.getElementById(formId);
@benbjurstrom
benbjurstrom / Code.gs
Last active September 10, 2024 10:16
PurgeOldEmails
/*
|--------------------------------------------------------------------------
| PurgeOldEmails
|--------------------------------------------------------------------------
| https://gist.github.com/benbjurstrom/00cdfdb24e39c59c124e812d5effa39a
|
*/
// Purge messages automatically after how many days?
var DELETE_AFTER_DAYS = 7
@HaoyangLiu
HaoyangLiu / ABCToken.sol
Last active November 9, 2022 16:27
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.4+commit.1dca32f3.js&optimize=true&gist=
pragma solidity 0.6.4;
import "./Context.sol";
import "./IERC20.sol";
import "./SafeMath.sol";
import "./Ownable.sol";
/**
* @dev Implementation of the {IERC20} interface.
*