Skip to content

Instantly share code, notes, and snippets.

@sr75
sr75 / wildcard-ssl-cert-for-testing-nginx-conf.md
Created June 1, 2013 18:35
create a self signed wildcard ssl cert for testing with nginx.conf example

just change out app_name for your purposes

openssl genrsa 2048 > app_name-wildcard.key

openssl req -new -x509 -nodes -sha1 -days 3650 -key app_name-wildcard.key > app_name-wildcard.cert

# Common Name (eg, your name or your server's hostname) []:*.app_name.com

openssl x509 -noout -fingerprint -text < app_name-wildcard.cert > app_name-wildcard.info
@esfand
esfand / typescript_angular.adoc
Last active September 30, 2022 12:37
AngularJS with TypeScript
@jpthompson23
jpthompson23 / HTTP_header_update_decorator.py
Last active March 24, 2016 09:46
Python decorator to update the header of an HTTP response from Flask or whatever
import flask
from flask.ext.classy import FlaskView, route
from functools import wraps
def charset_utf8(viewmethod):
# Let's update the 'Content-Type' in the HTTP header to tell the browser that the data we're
# responding with has utf-8 character encoding.
@wraps(viewmethod)
def new_viewmethod(*args, **kwargs):
resp = viewmethod(*args, **kwargs)
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@xmlking
xmlking / Enum.es6.js
Last active June 25, 2019 18:09
JavaScript Enums with ES6, Type Checking and Immutability
export class EnumSymbol {
sym = Symbol.for(name);
value: number;
description: string;
constructor(name: string, {value, description}) {
if(!Object.is(value, undefined)) this.value = value;
if(description) this.description = description;
@Deathnerd
Deathnerd / jinja.xml
Created April 8, 2015 00:37
Jinja Pycharm Live Templates
<templateSet group="jinja">
<template name="jinelse" value="{% else %}&#10; $END$" description="A simple else line" toReformat="true" toShortenFQNames="true">
<context>
<option name="HTML_TEXT" value="true" />
<option name="HTML" value="true" />
<option name="Django" value="true" />
</context>
</template>
<template name="jinblock" value="{% block $BLOCKNAME$ %}&#10;$END$&#10;{% endblock %}&#10;" description="A generic jinja block" toReformat="true" toShortenFQNames="true">
<variable name="BLOCKNAME" expression="" defaultValue="" alwaysStopAt="true" />
// https://raw.githubusercontent.com/donnut/typescript-ramda/master/ramda.d.ts
// https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/lodash/lodash.d.ts
declare namespace fp {
interface Dictionary<T> {
[index: string]: T;
}
interface CurriedFunction1<T1, R> {
@Humberd
Humberd / async-validator-wrapper.ts
Last active October 26, 2024 08:18
Async Validator Wrapper for Angular 2 Reactive Forms.This wrapper lets you debounce your asyncValidator instead of on every keystroke
import { AbstractControl } from "@angular/forms";
import { Observable } from "rxjs/Observable";
import { Subject } from "rxjs/Subject";
export class QstAsyncValidatorWrapper {
/*
* Angular async validators are triggered on every key stroke.
* This function debounces triggering an async validator.
*
@julienbourdeau
julienbourdeau / wilson.php
Last active August 13, 2024 12:55
[PHP] 5 Star Rating - Lower bound of Wilson score confidence interval for a Bernoulli parameter
<?php
/*
|--------------------------------------------------------------------------
| 5 Star Rating
|--------------------------------------------------------------------------
|
| Lower bound of Wilson score confidence interval for a Bernoulli parameter (0.9604)
|
| See:
@amir-arad
amir-arad / lodash.d.ts
Last active January 11, 2022 17:24 — forked from albohlabs/lodash.d.ts
fixed to pass strict mode validation, plus some generic types here and there
// https://raw.githubusercontent.com/donnut/typescript-ramda/master/ramda.d.ts
// https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/lodash/lodash.d.ts
declare namespace fp {
interface Dictionary<T> {
[index: string]: T;
}
interface CurriedFunction1<T1, R> {