Skip to content

Instantly share code, notes, and snippets.

View pcostesi's full-sized avatar

Pablo Alejandro Costesich pcostesi

View GitHub Profile
@rkh
rkh / Scala
Created April 2, 2010 19:08
examples for sinatra like frameworks
package com.thinkminimo.step
class StepExample extends Step {
get("/") { "Hello World!" }
}
/* Python(ish) string formatting:
* >>> format('{0}', ['zzz'])
* "zzz"
* >>> format('{x}', {x: 1})
* "1"
*/
var format = (function() {
var re = /\{([^}]+)\}/g;
return function(s, args) {
return s.replace(re, function(_, match){ return args[match]; });
@spudbean
spudbean / gist:1558257
Last active August 25, 2023 19:26
Look of disapproval and other emoticons
ಠ_ಠ
( ͡° ͜ʖ ͡°)
¯\_(ツ)_/¯
(╯°□°)╯︵ ┻━┻
http://www.fileformat.info/convert/text/upside-down.htm
WRTTN http://wrttn.me/30dbfd/
Unicode Emoticons
@scoffey
scoffey / webtail.py
Created January 15, 2012 20:04
HTTP server that provides a web interface to run "tail" on a file, like the Unix command
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
HTTP server that provides a web interface to run "tail" on a file,
like the Unix command.
This is a standalone script. No external dependencies required.
How to invoke:
@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong
@kennethreitz
kennethreitz / flaskapp.py
Created June 9, 2012 15:38
My typical flask app base
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask_heroku import Heroku
from flask_sslify import SSLify
from raven.contrib.flask import Sentry
from flask.ext.celery import Celery
@pcostesi
pcostesi / example.py
Created August 15, 2012 03:43
Flask view decorator to dispatch a request into different handlers by mimetypes.
@split
@login_required
def hello():
return render_template('hello.html')
@hello.for_mimetype("application/json")
@login_required
def hello():
return jsonify({"hello":"flask"})
@konklone
konklone / ssl.rules
Last active August 8, 2023 08:39
nginx TLS / SSL configuration options for konklone.com
# Basically the nginx configuration I use at konklone.com.
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
#
# To provide feedback, please tweet at @konklone or email eric@konklone.com.
# Comments on gists don't notify the author.
#
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
server {
@JanJakes
JanJakes / 00-readme.md
Last active July 27, 2023 11:32
Ubuntu server with Nginx, uWSGI and Node.js installation & deployment setup

Ubuntu with Nginx, uWSGI & Node.js and it's deployment

This Gist contains instructions to setup Ubuntu server with Nginx, uWSGI & Node.js with that can serve for any Python apps (Django for instance) and will allow it's automatized deployment.

The content is as follows:

  • 01-ubuntu.md – A basic Ubuntu server setup.
  • 02-nginx-uwsgi-nodejs.md – Nginx, uWSGI and Node.js installation and setup.
  • 03-deployment.md – A server setup for automatized deployment.
  • 04-mariadb.md – Mariadb installation and setup.
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
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