Skip to content

Instantly share code, notes, and snippets.

@dorfire
dorfire / acb.yaml
Created May 9, 2019 01:10
ACR Task for Oryx buildpack
steps:
- cmd: mcr.microsoft.com/oryx/pack:latest build {{.Run.Registry}}/nodeapp-{{.Run.ID}} --path . --builder mcr.microsoft.com/oryx/pack-builder:20190509.1
- push: ["{{.Run.Registry}}/nodeapp-{{.Run.ID}}"]
@dorfire
dorfire / notification_server.js
Created May 22, 2014 20:52
Node.js PostgreSQL notification server
const SOCKETIO_LISTEN_PORT = 81;
const PG_CONNECTION_STRING = 'postgres://dor@localhost/app';
const PG_NOTIFICATION_CHANNEL = 'notifications';
var pg = require('pg'),
sio = require('socket.io').listen(SOCKETIO_LISTEN_PORT);
var db = new pg.Client(PG_CONNECTION_STRING);
db.connect();
@dorfire
dorfire / fwatch.rb
Created November 29, 2013 10:17
Ruby file watch
#!/usr/bin/env ruby
require 'listen'
path = ARGV[0]
abspath = File.expand_path(path)
file_name = File.basename(path)
file_dir = File.dirname(path)
if File.exists?(path)
then
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
ServerName pow
ServerAlias *.dev
ServerAlias *.xip.io
ProxyPass / http://localhost:20559/
ProxyPassReverse / http://localhost:20559/
ProxyPreserveHost On
@dorfire
dorfire / Preferences.sublime-settings
Created October 12, 2012 13:32
My Sublime Text user configuration
{
"color_scheme": "Packages/Color Scheme - Default/Blackboard.tmTheme",
"font_size": 11.0,
"preview_on_click": true,
"word_wrap": false
}
@dorfire
dorfire / .zshrc
Created April 20, 2012 10:55
My cool ~/.zshrc file
export PATH=/usr/local/bin:/usr/local/share/python:$PATH
export LSCOLORS=dxfxcxdxbxegedabagacad
autoload -U colors && colors
setopt PROMPT_SUBST
setopt autocd
setopt hist_reduce_blanks
function prompt_char
@dorfire
dorfire / paginator.py
Created April 10, 2012 12:35
MongoDB paginator
from django.core import paginator
from django.core.paginator import EmptyPage, PageNotAnInteger
class Paginator(paginator.Paginator):
def __len__(self):
try:
return super(Paginator, self).__len__()
except TypeError:
return self.object_list.count()