Skip to content

Instantly share code, notes, and snippets.

@edin-m
edin-m / .gitignore
Last active September 12, 2016 20:19
MoEE zavrsni rad
node_modules
@edin-m
edin-m / gulpfile.js
Created June 24, 2016 11:03 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
-- Example table
CREATE TABLE ring_buffer (id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT);
-- Number 10 on where statement defines the ring buffer's size
CREATE TRIGGER delete_tail AFTER INSERT ON ring_buffer
BEGIN
DELETE FROM ring_buffer WHERE id%10=NEW.id%10 AND id!=NEW.id;
END;
@edin-m
edin-m / README.md
Last active August 29, 2015 14:21
node readable stream memory issue

Run server with

$ node server.js

Run client with

$ node client.js 30000
@edin-m
edin-m / angular-ui-router-redirect.js
Created March 13, 2015 17:50
Redirection with angular ui router states.
// this is needed when there are multiple hierarchy states
// articles
// articles.view
// articles.add
// articles.config
// articles.config.type1
// articles.config.type2
angular.module('articles')
.run([
'$rootScope',
# puttygen Deployment.ppk -L Deployment.ppk
# puttygen Deployment.ppk -O private-openssh -o Deployment.key.pvk
# http://stackoverflow.com/a/17427700/1293500
# bulk convert:
# cd ~/.putty
# for X in *.ppk; do puttygen $X -L > ~/.ssh/$(echo $X | sed 's,./,,' | sed 's/.ppk//g').pub; puttygen $X -O private-openssh -o ~/.ssh/$(echo $X | sed 's,./,,' | sed 's/.ppk//g').pvk; done;
@edin-m
edin-m / formidable-form-file-upload.js
Last active August 29, 2015 14:16
formidable form file upload
var express = require('express');
var formidable = require('formidable');
var app = express.createServer();
var AppController = {};
// AppController is synonym for another file's module.exports
AppController.uploadFile = function(req, res, next) {
var form = new formidable.IncomingForm();