Skip to content

Instantly share code, notes, and snippets.

@edin-m
edin-m / html5-video-play-file-blob.html
Last active April 6, 2024 19:32
HTML video play file blob object url
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<video></video>
<br/>
<input type="file" name="file" id="fileItem" onchange="onChange()" >
@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();
# 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 / 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',
@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
-- 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 / 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));
@edin-m
edin-m / .gitignore
Last active September 12, 2016 20:19
MoEE zavrsni rad
node_modules
@edin-m
edin-m / index.html
Last active October 19, 2018 22:48
L-Systems
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<canvas id="canvas" width="600" height="600" style="border: 1px solid black"></canvas>
<script src="index.js"></script>
@edin-m
edin-m / index.html
Last active November 12, 2018 20:02
Boardgame
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;