Skip to content

Instantly share code, notes, and snippets.

Anton Bacaj abacaj

Block or report user

Report or block abacaj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View main.dart
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:flutter/material.dart';
void main() {
title: 'Navigation Basics',
home: FirstScreen(items: List<String>.generate(40, (i) => "Item $i")),
abacaj /
Created Jan 30, 2017 — forked from austinhyde/
Vanilla JavaScript Data Binding


You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:

var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }

console.log(getN()); // 5
View move_files.cs
class Program
static void Main(string[] args)
Console.WriteLine("Enter base directory:");
var basePath = Console.ReadLine();
Console.WriteLine("Enter destination directory (this will be created for you, make sure it doesn't exist):");
var destination = Console.ReadLine();
var directories = System.IO.Directory.EnumerateDirectories(basePath);
View fizzbuzz.js
// Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
function fizzbuzz() {
for (var i = 1; i <= 100; i++) {
var str = "";
str += (i % 3 === 0) ? "fizz" : "";
str += (i % 5 === 0) ? "buzz" : "";
str = (str) ? str : i;
abacaj / HttpHandler.scala
Last active Oct 5, 2016
Using a Map to hold routes with Akka
View HttpHandler.scala
import scala.collection.mutable.Map
import scala.concurrent.ExecutionContextExecutor
import akka.http.scaladsl.model.ContentTypes
import akka.http.scaladsl.model.HttpEntity
import akka.http.scaladsl.model.HttpEntity.ChunkStreamPart
import akka.http.scaladsl.model.HttpEntity.apply
import akka.http.scaladsl.model.HttpProtocols
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.model.StatusCode
abacaj / fibonacci.js
Created Nov 16, 2015
A simple implementation of fibonacci in javascript.
View fibonacci.js
function fibonacci(size) {
var first = 0,
second = 1,
count = 2,
result = [first, second];
if(size < 2) {
abacaj / dom-util.js
Last active Nov 16, 2015
High performance utility for manipulating DOM classes.
View dom-util.js
var testDiv = document.querySelector('.test-div');
function filterSpaces(strArray) {
return strArray.filter(function(str) {
return /\S/.test(str);
function addClass(elem, className) {
var classes = filterSpaces(elem.className.split(' '));
abacaj / SassMeister-input-HTML.html
Created Jun 4, 2015
Generated by
View SassMeister-input-HTML.html
<span class="primary">#</span>
<span class="primary-l-1">#</span>
<span class="primary-l-2">#</span>
<span class="primary-l-3">#</span>
<span class="primary-l-4">#</span>
<span class="secondary">#</span>
abacaj / SassMeister-input-HTML.html
Created Apr 28, 2015
Generated by
View SassMeister-input-HTML.html
View calculateDate_php
this function will take in a due date and determine the remaining days until something is due from the current date.
public function calculateDate($due_date)
$future = strtotime($due_date);
$now = time();
$timeleft = $future-$now;
$daysleft = round((($timeleft/24)/60)/60);
You can’t perform that action at this time.