Skip to content

Instantly share code, notes, and snippets.

View jaf7's full-sized avatar

Anthony Fields jaf7

View GitHub Profile
@jaf7
jaf7 / easing.js
Created November 19, 2023 20:58 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@jaf7
jaf7 / new_gist_file.css
Created October 15, 2022 01:10 — forked from miguel12345/new_gist_file.css
Data uri, good for inline images (small ones, where the round trip time is bigger that the time it takes to download the image itself)
li {
background:
url(data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7)
no-repeat
left center;
padding: 5px 0 5px 25px;
}
@jaf7
jaf7 / dropshadow_modal.css
Created July 31, 2022 00:41 — forked from slivero/dropshadow_modal.css
A nice modal box with css dropshadow
.modal {
position: absolute;
top:0;
left:0;
z-index: 2000;
height:300px;
width:400px;
background-color: white;
border-radius:10px;
border: 1px solid rgba(0, 0, 0, 0.3);
The goal of Node was event driven HTTP servers.
5:04 https://youtu.be/M3BM9TB-8yA?t=304
1 Regret: Not sticking with Promises.
* I added promises to Node in June 2009 but foolishly removed them in February 2010.
* Promises are the necessary abstraction for async/await.
* It's possible unified usage of promises in Node would have sped the delivery of the eventual standartization and async/await.
* Today Node's many async APIs are aging baldly due to this.
6:02 https://youtu.be/M3BM9TB-8yA?t=362
@jaf7
jaf7 / watch_log.py
Created November 1, 2021 18:25 — forked from albsen/watch_log.py
python log file watcher
#!/usr/bin/env python
"""
Real time log files watcher supporting log rotation.
Author: Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>
License: MIT
"""
import os
@jaf7
jaf7 / nginx-cors.conf
Created July 30, 2021 19:45 — forked from sbuzonas/nginx-cors.conf
Nginx CORS maps
map $http_origin $allow_origin {
default "";
"~^https?://(?:[^/]*\.)?(stevebuzonas\.(?:com|local))(?::[0-9]+)?$" "$http_origin";
}
map $request_method $cors_method {
default "allowed";
"OPTIONS" "preflight";
}
jcigar@dev:/usr/local/etc/salt/states/venvs/python/ > cat _template.sls
{% import 'venvs/macros.jinja' as macros %}
{% set args = salt['pillar.get']('venvs:python:{}'.format(venv)) %}
{% set venv_base = salt['pillar.get']('venvs:lookup:base') %}
{% set venv_full = '{}/{}'.format(venv_base, venv) %}
include:
- users.webapps.{{ args.user }}
- pkgs.python
@jaf7
jaf7 / file_age.py
Created June 29, 2021 16:18 — forked from gmastrokostas/file_age.py
Python – Compare modification dates between files and find time difference
#!/usr/bin/python
#The script searches in a specific location for files and it gets in POSIX the time of modification of all files.
#It also creates a temp file (and write text in it) within the same directory (which gets deleted once the script exits)
#This temp file is used to get today's modification date. Then all POSIX dates are converted into human readable format
#and a comparison is done between the temp file and the files we are examining. If the files we are examining are
#three months or older, then .... you can enter what ever custom action you want.
import os.path
import tempfile
import datetime
@jaf7
jaf7 / pylink.sh
Created May 4, 2021 15:21 — forked from zvoase/pylink.sh
pylink - Link and unlink Python modules to your site packages directory.