Skip to content

Instantly share code, notes, and snippets.

@thomasvidas
thomasvidas / node-xcodebuild.ts
Created October 27, 2021 01:46
Typescript wrapper for xcodebuild
import { execSync, spawn, SpawnOptions } from 'child_process'
type XCodebuildOptions = {
/**
* Build the project specified by projectname.
* Required if there are multiple project files in the same directory.
*/
project: string,
/**
@cecilemuller
cecilemuller / launch.json
Last active May 16, 2024 16:38
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Example",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
@benjamincharity
benjamincharity / mockActivatedRoute.ts
Created April 12, 2017 16:23
Mock ActivatedRoute with params, data and snapshot.
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
MdToolbarModule,
],
providers: [
{
provide: Router,
useClass: MockRouter,
},
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@dergachev
dergachev / pandoc2redmine.sh
Created March 6, 2013 18:31
pandoc2redmine.sh - wrapper script on pandoc to fix textile output for Redmine compatibility
#! /bin/env bash
cat $1 | ruby -pe 'puts " "*20 if $_.match("^```$")' \
| pandoc -f markdown -t textile \
| ruby -r CGI -n -e 'print CGI.unescapeHTML($_);' \
| ruby -ne 'puts $_ unless $_.match(" "*20)' \
| pbcopy
# without spaces, pandoc outputs "bc." for code blocks, which isn't accepted to redmine
# it also annoyingly HTML escapes its pre- block contents