Skip to content

Instantly share code, notes, and snippets.

View iturgeon's full-sized avatar
💭
The answer is always YES

Ian Turgeon iturgeon

💭
The answer is always YES
View GitHub Profile
@jakub-g
jakub-g / async-defer-module.md
Last active June 29, 2024 11:47
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@mezzomondo
mezzomondo / aurora_vertical_scaling.md
Last active October 10, 2023 12:32
Automatic vertical scaling of an Aurora cluster

The problem (AKA don't waste money)

One of my clients is a big company that has a very variable but predictable database usage pattern. In the weekdays morning they come up with a huge amount of INSERTs and UPDATEs while for the rest of the day, form noon on, the usage is fairly limited to a decent amount of SELECTs with very low writing activity. The smallest class type that can handle the morning's volume is db.r3.large but having such an instance running all day long and in the weekends is just a big waste of resources money (or a big favour we do to Amazon, from their point of view).

The solution

So I was wondering if there's some autoscaling mechanism for Aurora writers (there is, but only for replicas),

@croxton
croxton / SSL-certs-OSX.md
Last active March 3, 2024 18:58 — forked from leevigraham/Generate ssl certificates with Subject Alt Names on OSX.md
Generate ssl certificates with Subject Alt Names

Generate ssl certificates with Subject Alt Names on OSX

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

DNS.1   = my-project.dev

Additional FQDNs can be added if required:

@eloypnd
eloypnd / dnsmasq_setup_osx.md
Last active June 16, 2024 04:23
wildcard DNS record on OS X in localhost development with dnsmasq

wildcard DNS in localhost development

$ brew install dnsmasq
   ...
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
  • edit /usr/local/etc/dnsmasq.conf
address=/local/127.0.0.1
@iturgeon
iturgeon / README.md
Last active October 30, 2023 14:06
How to run phpMyAdmin using the built in php webserver

Running phpMyAdmin localy on the built in php server

  1. make sure you have php 5.3+: run php -v
  2. Download phpmyadmin (github or main website)
  3. In the root directory, copy config.sample.inc.php > config.inc.php
  4. Edit config.inc.php, set $cfg['Servers'][$i]['host'] to the ip address of your mysql server (probably localhost or 127.0.0.1)
  5. In the root phpmyadmin directory run php -S localhost:8080
  6. open in your browser: http://localhost:8080
  7. log in by entering some valid credentials (a user you added or the root user)
@jackcarter
jackcarter / slack_delete.py
Last active November 29, 2023 07:03
Delete Slack files older than 30 days. Rewrite of https://gist.github.com/jamescmartinez/909401b19c0f779fc9c1
import requests
import time
import json
token = ''
#Delete files older than this:
ts_to = int(time.time()) - 30 * 24 * 60 * 60
def list_files():
@henry0312
henry0312 / controller
Created February 15, 2014 10:47
Inserting multiple rows on FuelPHP
public function action_index()
{
Model_Test::test(); exit;
}
@pyk
pyk / active-record-migration-expert.md
Last active August 2, 2021 09:20
become active record migration expert (Rails 4.0.2)

become active record migration expert (Rails 4.0.2)

workflow:

create model

$ rails g model NameOfModel
    invoke  active_record
    create    db/migrate/YYYYMMDDHHMMSS_create_name_of_models.rb
@adamalbrecht
adamalbrecht / ngDebounce.js
Last active December 9, 2022 20:16
Simple debounce function for Angular.js found at the link below and slightly tweaked. http://plnkr.co/edit/fJwRER?p=info
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
angular.module('ngDebounce', []).factory('$debounce', function($timeout, $q) {
return function(func, wait, immediate) {
var timeout;
var deferred = $q.defer();
return function() {
var context = this, args = arguments;
@willurd
willurd / web-servers.md
Last active June 30, 2024 03:01
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000