Skip to content

Instantly share code, notes, and snippets.


Pablo Armentano pabliqe

View GitHub Profile
mayneyao / notion2blog.js
Last active Jan 14, 2022 > Personal Blog | custom domain + disqus comment
View notion2blog.js
const MY_DOMAIN = ""
const START_PAGE = ""
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
yidas /
Last active Jan 20, 2022
JavaScript nl2br & br2nl functions

JavaScript nl2br & br2nl functions

The exchange of new line & br HTML tag could refer to PHP - nl2br() function, which uses to inserts HTML line breaks before all newlines in a string.

These JavaScript functions consider whether to use insert or replace to handle the swap.


aleclarson /
Last active Sep 21, 2020
node-gyp build.js

Build the native binding of a NodeJS library for multiple platforms/versions.

With no arguments, this script use the nearest node-gyp installation to build binding.gyp for the version of node being used. Then it looks for binding.node in the resulting build/Release directory, and copies it into the vendor directory (created on-the-fly). You will find it inside a subdirectory named ${process.platform}-${process.arch}-${moduleVersion}.

When --target or --version are undefined, this script resolves their values for you.

NOTE: You must specify --version if you specify --target as a version not currently used by your shell.

After building the native binding, you can npm rm bindings and use the provided binding.js module for loading your native binding with require. The binding.js module is smart enough to know which vendor subdirectory contains the appropriate binding for the current process.

View opengraph.html
<meta property="fb:app_id" content="406655189415060">
<meta property="og:site_name" content="Giphy">
<meta property="og:url" content="">
<meta property="og:title" content="Animated GIF">
<meta property="og:description" content="The best GIFs are on Giphy">
<meta property="og:type" content="video.other">
<meta property="og:image" content="">
<meta property="og:image:width" content="912">
thomastuts / gulpfile.js
Created Feb 27, 2015
Splitting up Gulp tasks in separate files
View gulpfile.js
// gulpfile.js
var gulp = require('gulp');
var requireDir = require('require-dir');
var tasks = requireDir('./tasks');
gulp.task('sass', tasks.sass);
gulp.task('serve:dist', tasks.serve.dist);
DavidWells / reset.css
Last active Jan 19, 2022 — forked from karbassi/reset.css
CSS reset. Follow me on the twitters for more tips:
View reset.css
v2.0-modified | 20110126
License: none (public domain)
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
sviatco / ip.js
Last active Aug 19, 2021
Get local external ip address with nodejs
View ip.js
// Local ip address that we're trying to calculate
// Provides a few basic operating-system related utility functions (built-in)
,os = require('os')
// Network interfaces
,ifaces = os.networkInterfaces();
// Iterate over interfaces ...
danharper / background.js
Last active Jan 20, 2022
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
View background.js
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
cobyism /
Last active Jan 19, 2022
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).