Skip to content

Instantly share code, notes, and snippets.

@ErikAndreas
ErikAndreas / default.pp
Created May 7, 2014 10:32
Vagrant puppet nginx node.js nodemon on Ubuntu 14.04
group { 'puppet': ensure => 'present' }
File { ignore => '.svn' }
exec { 'apt-get update':
command => '/usr/bin/apt-get update'
}
package { 'python-software-properties':
ensure => present,
@ErikAndreas
ErikAndreas / PJAX with RactiveJS idea.md
Last active October 7, 2015 09:22
PJAX with Ractive.js

Got a repo for this now: https://github.com/ErikAndreas/pjax-ractivejs

Start from/change/extend https://github.com/thybag/PJAX-Standalone with

  • CommonJS format and Browserify
  • Q around Superagent for XHR Promises
  • No need to support more than data-pjax equivalent attribute
  • Same Ractive templates on client as well as server (Ractive is isomorphic)
  • Use Ractive for rendering of client side instead of PJAX "standard" of returning/render full html (also, page title element in response is hideous) and just return data (json) from server, kind of what twitter seem to be doing
@ErikAndreas
ErikAndreas / app.js
Created March 14, 2014 14:39
Draft to git(lab?) webhooks forwarding to xmpp (ejabberd2) muc with node.js
var Client = require('node-xmpp-client'),
ltx = require('ltx'),
express = require('express'),
app = express();
room_jid = '[email protected]',
room_nick = 'GIT';
// valid user on im server (im.domain.com)
var client = new Client({
jid: '[email protected]',
@ErikAndreas
ErikAndreas / gist:6119825
Last active December 20, 2015 10:59
Node.js streaming upload (and no tmp file on disk) with Multiparty with pipe to gunzip
"use strict";
var multiparty = require('multiparty')
, http = require('http')
, util = require('util')
, zlib = require('zlib');
http.createServer(function(req, res) {
if (req.url === '/upload' && req.method === 'POST') {
var form = new multiparty.Form();
@ErikAndreas
ErikAndreas / 0background.md
Last active December 18, 2015 16:49
Proof of concept of full stack and tooling for AngularJS i18n gettext-style using Jed, pybabel and po2json. UPDATE: will now be maintained at https://github.com/ErikAndreas/lingua and tooling at https://github.com/ErikAndreas/grunt-lingua

Been looking for a full stack including tools for gettext-style i18n with AngularJS.

  • Gettext-style support in markup (html and javascript) supporting singular, plural and interpolation/sprintf
  • Tooling for extraction of strings to be translated (to .pot) from html and javascript
  • Tooling for generating .json of .po files

Ended up (working proof of concept) with the following:

  • "lingua", an AngularJS module wrapping Jed
  • Some AngularJS bootstrapping
  • pybabel for xgettext style translations extraction (to .pot)
  • po2json for generating .json files (per translation) from .po files
@ErikAndreas
ErikAndreas / index.html
Created December 7, 2011 12:07
Spotify Apps Api - Tabs
<script type="text/javascript">
function init() {
console.log("init()");
sp = getSpotifyApi(1);
// detects arguments value for tab
sp.core.addEventListener("argumentsChanged", function (event) {
console.log('args changed', sp.core.getArguments());
});
}
</script>