Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active May 9, 2024 08:24
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

**Jeff Escalante**
# Dato & Contentful
There are many areas in which I'd consider Dato to be much stronger of a CMS than
contentful, and one in which I'd consider the opposite to be the case. I will try to be as
balanced as possible with this overview, as I am not employed by dato or anything ‐ my
goal is to ensure that my clients and developers get the best possible experience working
with a CMS.
// https://webreflection.medium.com/using-the-input-datetime-local-9503e7efdce
Date.prototype.toDatetimeLocal =
function toDatetimeLocal() {
var
date = this,
ten = function (i) {
return (i < 10 ? '0' : '') + i;
},
YYYY = date.getFullYear(),
MM = ten(date.getMonth() + 1),
@timneutkens
timneutkens / index.js
Last active March 4, 2024 14:01
Clear console/terminal in node.js the right way
const readline = require('readline')
const blank = '\n'.repeat(process.stdout.rows)
console.log(blank)
readline.cursorTo(process.stdout, 0, 0)
readline.clearScreenDown(process.stdout)
@jsonmaur
jsonmaur / bzexcluderules_editable.xml
Last active April 9, 2024 04:47
Backblaze Custom Exclude
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/_build/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/deps/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
@jakebathman
jakebathman / StateBoundaries.sql
Last active February 12, 2024 00:14
The approximate max/min latitude and longitude for all states and major territories
-- Create the table
CREATE TABLE IF NOT EXISTS `StateBoundaries` (
`State` varchar(10) DEFAULT NULL,
`Name` varchar(255) DEFAULT NULL,
`MinLat` varchar(50) DEFAULT NULL,
`MaxLat` varchar(50) DEFAULT NULL,
`MinLon` varchar(50) DEFAULT NULL,
`MaxLon` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@nurely
nurely / deployApplication.php
Last active March 29, 2023 09:15
You can use this script to handle the Git Auto Deployment on Cloudways for any number of servers and applications using Git Webhooks.
<?php
const API_KEY = "YOUR API KEY HERE";
const API_URL = "https://api.cloudways.com/api/v1";
const EMAIL = "YOUR EMAIL GOES HERE";
/* examples
const BranchName = "master";
const GitUrl = "git@bitbucket.org:user22/repo_name.git";
*/
@rcanepa
rcanepa / gist:8a334d7c4f46df948c676aab489fe2c2
Last active January 5, 2024 07:33
Undo committed files (move them back to the staging area without cancelling changes)
- Reset current branch to the parent of HEAD
git reset --soft HEAD~
- Reset the unwanted files in order to leave them out from the commit:
git reset HEAD path/to/unwanted_file
- Commit again using the same commit message:
git commit -c ORIG_HEAD
(*) git reset --soft HEAD~
@adamreisnz
adamreisnz / package.json
Last active January 19, 2024 13:01
Simple pure npm scripts build process
{
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "http://www.project-name.com",
"author": {
"name": "Adam Reis",
"url": "http://adam.reis.nz"
},
"license": "UNLICENSED",
@sorenlouv
sorenlouv / batch-promise.js
Last active June 29, 2022 14:31
Execute promises sequentially in batches
var Q = require('q');
function batchPromises(items, fn, options) {
var results = [];
var index = (options.batchSize - 1);
function getNextItem() {
index++;
if (items.length > index) {
var nextItem = items[index];