Skip to content

Instantly share code, notes, and snippets.

View Integralist's full-sized avatar
🎯
Making an impact

Mark McDonnell Integralist

🎯
Making an impact
View GitHub Profile
@Integralist
Integralist / Makefile
Last active January 22, 2024 00:30 — forked from isaacs/Makefile
Example of a detailed Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@Integralist
Integralist / GitHub curl.sh
Last active September 7, 2023 03:53 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@Integralist
Integralist / backend_template.vcl
Last active March 18, 2022 09:58 — forked from hrmsk66/backend_definition_via_loop.md
[Terraform create backend definitions from a list of hostnames] #terraform #fastly #work
backend F_${backendname} {
.between_bytes_timeout = 10s;
.connect_timeout = 1s;
.dynamic = true;
.first_byte_timeout = 15s;
.host = "${hostname}";
.max_connections = 200;
.port = "443";
.share_key = "...";
.ssl = true;
@Integralist
Integralist / profile_ctx.py
Last active June 7, 2020 15:20 — forked from andriykohut/profile_ctx.py
[Python profiling context management] #python #profiling #performance
import cProfile
import contextlib
import io
import pstats
import sys
import timeit
@contextlib.contextmanager
def prof(*restrictions, stdout=True, dump=None, sortby='cumulative'):
@Integralist
Integralist / ext.vim
Last active February 11, 2019 10:32 — forked from sjl/ext.vim
Some basic examples of executing external commands within Vim's COMMAND-LINE mode
" run command
" no stdin
" output displayed in "Press enter to continue" style
" current buffer untouched
:!uptime
" run command
" pipe range of text to command on stdin
" output replaces the range in the current buffer
:RANGE!grep foo
# https://minhajuddin.com/2016/03/03/put-this-in-your-code-to-debug-anything
require 'rouge'
require 'method_source'
require 'pp'
class Dbg
def initialize(object, to:)
@object, @stream = object, to
end
@Integralist
Integralist / inherit-by-proxy.js
Last active December 20, 2015 01:09 — forked from jeremyckahn/inherit-by-proxy.js
JavaScript: inheritance by proxy
function inherit (child, parent) {
function proxy () {};
proxy.prototype = parent.prototype;
child.prototype = new proxy();
};
function Parent () {}
function Child () {}
inherit(Child, Parent);
@Integralist
Integralist / find-or-fallback.js
Last active December 19, 2015 21:18 — forked from WebReflection/find-or-fallback.js
JavaScript function that lets you query for the API or provide a fallback if not available
function findOrFallback(where, what, fallback) {
for(var
vendors = ['', 'webkit', 'moz', 'ms', 'o'],
first = what.charAt(0),
others = first.toUpperCase(),
suffix = what.slice(1),
i = 0, length = vendors.length,
current;
i < length; i++
) {
@Integralist
Integralist / reading_time.rb
Last active December 18, 2015 16:39 — forked from zachleat/reading_time.rb
Ruby: calculate reading time based on length of text
# Outputs the reading time
# Read this in “about 4 minutes”
# Put into your _plugins dir in your Jekyll site
# Usage: Read this in about {{ page.content | reading_time }}
module ReadingTimeFilter
def reading_time( input )
words_per_minute = 180
@Integralist
Integralist / addEventListener-polyfill.js
Last active December 17, 2015 04:09 — forked from eirikbacker/addEventListener-polyfill.js
addEventListener polyfill
//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence
(function(win, doc){
if(win.addEventListener)return; //No need to polyfill
function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}}
function addEvent(on, fn, self){
return (self = this).attachEvent('on' + on, function(e){
var e = e || win.event;
e.preventDefault = e.preventDefault || function(){e.returnValue = false}
e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true}