Skip to content

Instantly share code, notes, and snippets.

@branneman
branneman / better-nodejs-require-paths.md
Last active October 18, 2024 20:29
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@thoop
thoop / nginx.conf
Last active November 12, 2024 19:08
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@ogryzek
ogryzek / social_meta.html
Created February 22, 2014 18:47
Social media meta tags reference: Thanks to https://twitter.com/j_holtslander
<html>
<head>
<title>__________</title>
<!--[if lt IE 9]>
<script src="https://raw.github.com/aFarkas/html5shiv/master/src/html5shiv.js"></script>
<![endif]-->
<meta charset="utf-8">
<meta name="robots" content="noarchive"> <!-- Noarchive will prevent Google caching the page. -->
<meta name="keywords" data-page-subject="true" content="keyword,keyword,keyword,keyword,keyword,keyword,keyword" /> <!-- Relevant Keywords -->
<link rel="shortcut icon" href="favicon.ico">
@rtt
rtt / tinder-api-documentation.md
Last active October 17, 2024 17:55
Tinder API Documentation

Tinder API documentation

Note: this was written in April/May 2014 and the API may has definitely changed since. I have nothing to do with Tinder, nor its API, and I do not offer any support for anything you may build on top of this. Proceed with caution

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

@brucecoddington
brucecoddington / resources.js
Last active June 27, 2020 14:42
Wrapping $resource with api and data services.
angular.module('app.resources', ['ngResource'])
.factory('api', function ($resource) {
var api = {
defaultConfig : {id: '@id'},
extraMethods: {
'update' : {
method: 'PUT'
}
@kwilczynski
kwilczynski / kafka.service
Last active February 17, 2021 05:10
kafka.service for systemd
[Unit]
Description=Apache Kafka server (broker)
Documentation=http://kafka.apache.org/documentation.html
Requires=network.target remote-fs.target syslog.target
After=network.target remote-fs.target syslog.target
ConditionPathExists=/etc/kafka/server.properties
ConditionPathExists=/var/lib/kafka
[Service]
Type=simple
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active October 1, 2024 17:10
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@tvdstaaij
tvdstaaij / protobufjs-stringify-enums.js
Last active June 30, 2016 14:51
Convert ProtoBuf.js enum values to strings using reflection
var _ = require('lodash');
function stringifyEnums(message) {
_.forEach(message.$type.children, function(child) {
var type = _.get(child, 'element.resolvedType', null);
if (type && type.className === 'Enum' && type.children) {
var metaValue = _.find(type.children, {
id: message[child.name]
});
if (metaValue && metaValue.name)
#!/bin/bash -xv
### Country list
# CHANGE WITH YOUR COUNTRIES
COUNTRIES="europe/france/guadeloupe europe/france/guyane europe/france/mayotte europe/france/martinique europe/france/reunion europe/france"
# SMALL SUBSET FOR TESTING:
COUNTRIES="europe/france/guyane europe/france/mayotte"
NOMINATIM="/var/www/Nominatim"
cd $NOMINATIM/data