Skip to content

Instantly share code, notes, and snippets.

View danihodovic's full-sized avatar

Dani Hodovic danihodovic

View GitHub Profile
@danihodovic
danihodovic / gulp-browserify-esnext
Last active August 29, 2015 14:07
Browserify + Esnext + Watch + Errorhandling
var gulp = require('gulp')
var source = require('vinyl-source-stream')
var buffer = require('vinyl-buffer')
var browserify = require('browserify')
var esnext = require('gulp-esnext')
var notify = require('gulp-notify')
var build_dir = './bin'
var browserify_input = './main.js'
@danihodovic
danihodovic / app.py
Last active August 29, 2015 14:07
Flask Deployment Simple Example
# File /var/www/wsgi_app/app.py
# The Flask application
#!/usr/bin/env python
from flask import Flask
app = Flask(__name__)
function benchmark(args) {
var error_msg = [
"Provide an object with at least a func keyword, example:",
"{func: function, thisarg: thisarg, times:times}",
"func must be an instanceof Function"
].join('\n');
return function() {
if (!(args.func instanceof Function)) {
throw new Error(error_msg)
@danihodovic
danihodovic / jshintrc
Created November 23, 2014 02:35
jshintrc
{
//Restricting
"bitwise": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": "func",
"newcap": true,
"noarg": true,
@danihodovic
danihodovic / gulpfile.js
Created February 28, 2015 19:58
Gulp + Tsc without wrappers
gulp.task('main', function () {
native_tsc_task(d_src, d_out, js_out)
})
var spawn = require('child_process').spawn
function native_tsc_task(main_file, out_file, out_dir) {
var child = spawn('tsc', [main_file, '--out', out_dir + out_file, '--target', 'es5', '--noEmitOnError', '--sourceMap'])
var child_output = ''
child.stdout.on('data', function(data) { child_output += data.toString() } )
child.stdout.on('end', function(data) { handle_tsc_output(main_file, child_output) } )
sudo apt-get remove --purge eclipse*
rm -rf ~/.eclipse
rm -rf ~/.config/eclipse
rm -rf <workspace_dir>/.metadata
@danihodovic
danihodovic / binarytree.go
Last active August 30, 2015 22:38
Go Binary Tree Stuff
package main
import (
"log"
)
type node struct {
val int
leftChild *node
rightChild *node
set smoothscroll
set noautofocus
let scrollstep = 150
let barposition = "bottom"
map <space> :
map go scrollToTop
map > goForward
map < goBack
@danihodovic
danihodovic / main.tf
Created January 8, 2017 20:48
Terraform - static site using S3, Cloudfront and Route53
variable "aws_region" {
default = "eu-west-1"
}
variable "domain" {
default = "my_domain"
}
provider "aws" {
region = "${var.aws_region}"
@danihodovic
danihodovic / reset.sh
Created April 21, 2018 23:35
Reset react-native Android cache
# Reset / delete problematic node_modules
npx react-native start --reset-cache
npx react-native run-android