Skip to content

Instantly share code, notes, and snippets.

View jankapunkt's full-sized avatar
🏠
Working from home

Jan Küster jankapunkt

🏠
Working from home
View GitHub Profile
@stbaer
stbaer / tinytest.api
Last active November 15, 2016 19:10
Meteor tinytest api
test.isFalse(v, msg)
test.isTrue(v, msg)
test.equal(actual, expected, message, not)
test.length(obj, len)
test.include(s, v)
test.isNaN(v, msg)
test.isUndefined(v, msg)
test.isNotNull
test.isNull
test.throws(func)
@nidico
nidico / issue-migrate-bitbucket-to-github.py
Created September 24, 2012 21:00
Helper script for issue migration from Bitbucket to GitHub
#!/usr/bin/env python
"""
This script helps migrating issues from Bitbucket to GitHub.
It currently ignores milestones completly and doesn't care whether an issue is
open, new or on hold. As long as it's not closed it's considered open.
To use it, install python-bitbucket, PyGithub and ipdb.
@theotow
theotow / gist:8577001
Created January 23, 2014 11:22
binary md5 hashing in nodejs
var md5 = crypto.createHash('md5').update(string).digest('binary');
md5 = new Buffer(md5, "binary").toString('base64');
@lukas-zech-software
lukas-zech-software / circular.js
Last active July 9, 2019 11:04
Detect circular references in objects
// http://blog.vjeux.com/2011/javascript/cyclic-object-detection.html.
function isCyclic (obj) {
var seenObjects = [];
function detect (obj) {
if (obj && typeof obj === 'object') {
if (seenObjects.indexOf(obj) !== -1) {
return true;
}
seenObjects.push(obj);
@TimFletcher
TimFletcher / regex_ejson.js
Created December 6, 2016 16:17
Code to add a Regex type to Meteor's EJSON
import { EJSON } from 'meteor/ejson';
function getOptions(self) {
const opts = [];
if (self.global) opts.push('g');
if (self.ignoreCase) opts.push('i');
if (self.multiline) opts.push('m');
return opts.join('');
}
@possibilities
possibilities / meteor-async.md
Created August 23, 2012 22:53
Meteor Async Guide

From Meteor's documentation:

In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.

This guide serves as a mini-tour of tools, trix and patterns that can be used to run async code in Meteor.

Basic async

Sometimes we need to run async code in Meteor.methods. For this we create a Future to block until the async code has finished. This pattern can be seen all over Meteor's own codebase:

@danrubins
danrubins / README.md
Last active December 20, 2020 02:05
Legal Robot's options for helmet.js

Security Headers at Legal Robot

We're big fans of open source software at Legal Robot. We also know that getting security right is a tough job, so we want to share some of the useful tools we use to build and run Legal Robot and keep it secure.

We are also proud to run Legal Robot on the Meteor framework for Node.js. With this recent change, Helmet.js becomes the official recommendation for security headers in Meteor, replacing the previous Meteor browser-policy package.

One of the most helpful tools in our Meteor security toolbox at Legal Robot is Content Security Policy (CSP)  — basically, our server tells the browser what code it is allowed to run and how to handle something like code injection from a malicious browser extension.

CSP can be quite tricky, but there are some excellent tools out there to help, like [Google'

@buchnema
buchnema / diceware6-openthesaurus.sh
Created September 19, 2016 10:14
Creating German diceware wordlist from Open Thesaurus for six-sided dice
#!/bin/bash
: <<'COMMENT'
This script takes the dataset from the Open Thesaurus project and
transforms it to a wordlist comparable to the original diceware list.
I thought the original list contains too much lines which just don't
make any sense and/or are hard to memorize. So my goal was to
automatically generate a list containing only memorable words, which
can then be used to add your own special characters or variations.
@mtrung
mtrung / Android TimeZone Ids
Last active August 23, 2022 09:06 — forked from arpit/Android TimeZone Ids
As of July 2015, there are 582 Java/Android TimeZone Ids. Note that this list is subject to change (there are 23 additions and 2 deletions from 2011 to 2015).
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@aerispaha
aerispaha / index.html
Created January 6, 2017 17:06
Make Plotly figures responsive in Bootstrap by assigning class
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Responsive Plotly Charts</title>
<!-- Bootstrap -->
<link href="/static/css/bootstrap.min.css" rel="stylesheet">