Skip to content

Instantly share code, notes, and snippets.

@theodorosploumis
theodorosploumis / Nework_throttling_profiles.md
Last active August 16, 2024 02:39
Web development - Custom network throttling profiles
Profile download (kb/s) upload (kb/s) latency (ms)
Native 0 0 0
GPRS 50 20 500
56K Dial-up 50 30 120
Mobile EDGE 240 200 840
2G Regular 250 50 300
2G Good 450 150 150
3G Slow 780 330 200
@motin
motin / commit-using-commitizen-in-new-iterm-window.scpt
Last active January 10, 2023 18:57
Add as SourceTree custom action: Open in Seperate Window (checked), Script to run `/path/to/commit-using-commitizen-in-new-iterm-window.sh` (this path MUST NOT contain spaces due to long-standing SourceTree bug https://jira.atlassian.com/browse/SRCTREE-2150), Parameters: `$REPO`
on run argv
set repoPath to (item 1 of argv)
tell application "iTerm"
set newWindow to (create window with default profile)
tell current session of newWindow
write text "cd " & quoted form of repoPath & " && npx git-cz"
end tell
end tell
end run
@ebidel
ebidel / smoothscroll.js
Last active January 17, 2019 02:22
Smooth scroll page
(function() {
const scroller = document.scrollingElement || document.body;
// Smooth scrolls to the bottom of the page.
window.smoothScrollPage = (y = scroller.scrollHeight) => {
scroller.style.scrollBehavior = 'smooth';
scroller.scrollTop = y;
scroller.style.scrollBehavior = '';
};
@mariotacke
mariotacke / README.md
Created March 7, 2017 04:36
Default nginx log format (combined) and grok pattern
@dengjonathan
dengjonathan / index.js
Last active February 20, 2017 10:26
minimal express.js server
var express = require('express');
var app = express();
var path = require('path');
app.use(express.static(path.join(__dirname)));
app.use("/styles", express.static(__dirname));
app.use("/images", express.static(__dirname + '/images'));
app.use("/scripts", express.static(__dirname + '/scripts'));
// viewed at based directory http://localhost:8080/
@victusfate
victusfate / rawBatchJob.js
Last active December 16, 2016 08:35
graceful queue and worker shutdown take 1
'use strict';
const kue = require('kue');
const url = require('url');
const redis = require('redis');
var getRedis = () => {
var redisUrl = url.parse(process.env.LOCAL_REDIS_URL || config.Redis.RedisUrl)
, client = redis.createClient(redisUrl.port, redisUrl.hostname);
// console.log({ action: 'app', redisUrl: redisUrl });
if (redisUrl.auth) {
@remarkablemark
remarkablemark / README.md
Last active June 8, 2024 21:48
Classes - ES5 vs ES6

JavaScript Classes - ES5 vs ES6

An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.

Reference

@dominikwilkowski
dominikwilkowski / README.md
Last active October 19, 2020 03:52
Ubuntu setup with NGINX http/2 and letsencrypt

Intro

This is a basic collection of things I do when setting up a new headless ubuntu machine as a webserver. Following the steps below should give you a reasonable secure server with HTTP/2 support (including ALPN in chrome) and the fast NGINX server. I am happy to add things so leave a comment.

Basics

After creating the server (droplet on DigitalOcean) log in with

@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active September 7, 2024 14:29
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@noahmiller
noahmiller / baseModel.js
Created April 30, 2016 02:03
Backbone.Model Properties by Configuration
/**
* A model base class that extends Backbone.Model to provide both
* common functionality and common model properties.
*
* Common properties are defined by property configuration data objects returned
* by the propConfig getter.
*
* Common functionality determined by propConfig includes:
* - defaults
* - server data parsing