Skip to content

Instantly share code, notes, and snippets.

View mattj1's full-sized avatar

Matt Johnson mattj1

View GitHub Profile
@joepie91
joepie91 / express-server-side-rendering.md
Last active April 26, 2025 08:11
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@madhikarma
madhikarma / build.sh
Last active June 8, 2020 08:33
xcodebuild script
#!/bin/sh
set -eo pipefail
IFS=$'\n\t'
# Constants
NOW=$(date +%s)
BUILD_FILE_NAME="MyApp-${NOW}"
SCHEME="MyApp"
WORKSPACE="MyApp"
PROJECT="MyApp"
@mikoim
mikoim / nginx.conf
Created October 28, 2016 21:22
Split RTMP Stream with nginx-rtmp-module
worker_processes 1;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 8192;
@parzivail
parzivail / TILCD.cpp
Created September 10, 2016 00:56
TI83 LCD Pinout and original Arduino code
TILCD::TILCD(uint8_t ce, uint8_t di, uint8_t wr, uint8_t rst, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
{
_ce = ce;
_di = di;
_wr = wr;
_rst = rst;
_d0 = d0;
_d1 = d1;
_d2 = d2;
@idevsoftware
idevsoftware / xcode-build-version-number.sh
Created July 13, 2016 02:46
Run Script Build Phase for Xcode to automatically increase CFBundleVersion
#!/bin/bash
# Run Script Build Phase for Xcode to automatically increase the CFBundleVersion value
# on your target's Info.plist using a 'yymmddHHMMSS' style timestamp.
# Also, sets a custom key with the current git commit hash (GIT_COMMIT_HASH)
#
# This script works by modifying the target copy of your Info.plist file, so that it won't
# change your original Info.plist which is under version control. It does, however, use
# the original file to read the initial CFBundleVersion value to which the timestamp
# for the current date/time is appended.
@joepie91
joepie91 / vpn.md
Last active January 12, 2026 02:35
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@zchee
zchee / actionlist.vim
Last active January 5, 2026 16:15
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@jdryg
jdryg / RayCapsuleTest.cpp
Created May 3, 2015 10:24
Ray/Capsule intersection test
class CVector3f
{
public:
float x, y, z;
CVector3f()
{}
CVector3f(float xx, float yy, float zz) : x(xx), y(yy), z(zz)
{}

Git Cheat Sheet

Commands

Getting Started

git init

or

@zqqf16
zqqf16 / IPSecDemo.m
Last active May 29, 2020 08:11
Start IPSec programmatically in iOS 8
- (void)viewDidLoad
{
[super viewDidLoad];
// init VPN manager
self.vpnManager = [NEVPNManager sharedManager];
// load config from perference
[_vpnManager loadFromPreferencesWithCompletionHandler:^(NSError *error) {