Skip to content

Instantly share code, notes, and snippets.

@maryo
maryo / download.js
Created January 28, 2019 01:24
Typekit font downloader
const https = require('https');
const fs = require('fs');
// https://github.com/majodev/google-webfonts-helper/blob/master/server/logic/conf.js
const FORMAT_USER_AGENTS = {
// see http://www.dvdprojekt.de/category.php?name=Safari for a list of sample user handlers
// test generation through running grunt mochaTest:src
eot: 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)',
woff: 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0',
// must serve complete woff2 file for one variant (no unicode range support yet!)
@marcellodesales
marcellodesales / ec2-host-from-tag-to-env-vars.sh
Last active November 8, 2022 11:49
Create Environment Variables in EC2 Hosts from EC2 Host Tags, just like Beanstalk or Heroku does!
######
# Author: Marcello de Sales (marcello.desales@gmail.com)
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
#
### Requirements:
# * Install jq library (sudo apt-get install -y jq)
# * Install the EC2 Instance Metadata Query Tool (http://aws.amazon.com/code/1825)
#
### Installation:
# * Add the Policy EC2:DescribeTags to a User
@DenisIzmaylov
DenisIzmaylov / INSTALLATION.md
Last active April 27, 2023 15:44
OS X 10.11 El Capitan: fresh install with Node.js (io.js) Developer Environment

OS X 10.11 (El Capitan) / Node.js and io.js Developer Environment

Custom recipe to get OS X 10.11 El Capitan running from scratch with useful applications and Node.js Developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after fresh install.

Content

@atiaxi
atiaxi / failable.py
Last active September 7, 2016 04:47
import praw
from requests.exceptions import ConnectionError, HTTPError, Timeout
def failable(f):
def wrapped(*args, **kwargs):
try:
return f(*args, **kwargs)
except praw.errors.APIException:
full = traceback.format_exc()
logging.warning("Reddit API call failed! %s" % full)
@alojzije
alojzije / connectHTMLelements_SVG.png
Last active March 24, 2024 19:36
Connect two elements / draw a path between two elements with SVG path (using jQuery)
connectHTMLelements_SVG.png
@kirang89
kirang89 / model_relation_ex.py
Created April 7, 2014 18:59
Example for many-to-many relationship with extra columns in SQLAlchemy
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship
engine = sqlalchemy.create_engine('sqlite:///:memory:')
Base = declarative_base()
@em0ney
em0ney / example.html
Last active June 15, 2018 17:53
A list-group-addon for prepending glyphicons to list groups in Bootstrap-3
<ul class="list-group">
<li class="list-group-item-cust list-group-item"><span class="list-group-addon glyphicon glyphicon-calendar"></span>
&nbsp;8th March 2014</li>
<li class="list-group-item-cust list-group-item"><span class="list-group-addon glyphicon glyphicon-time"></span>
&nbsp;10:00</li>
<li class="list-group-item-cust list-group-item"><span class="list-group-addon glyphicon glyphicon-flag"></span>
&nbsp;Location</li>
</ul>
@avibryant
avibryant / loess.js
Created August 17, 2011 15:45
Loess smoothing
//adapted from the LoessInterpolator in org.apache.commons.math
function loess_pairs(pairs, bandwidth)
{
var xval = pairs.map(function(pair){return pair[0]});
var yval = pairs.map(function(pair){return pair[1]});
console.log(xval);
console.log(yval);
var res = loess(xval, yval, bandwidth);
console.log(res);
return xval.map(function(x,i){return [x, res[i]]});