Skip to content

Instantly share code, notes, and snippets.

View nachinius's full-sized avatar
🏠
Working...

nachinius nachinius

🏠
Working...
  • Berlin, DE
View GitHub Profile
@nachinius
nachinius / Vagrantfile
Created November 11, 2014 18:01
vagrant with two vm, one apache, other mysql and mariadb
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
<?php
/*
* This file is part of the Symfony package. (c) Fabien Potencier <fabien@symfony.com> For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
*/
namespace Symfony\Component\Yaml\Tests;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Dumper;
@nachinius
nachinius / gist:0a40f4f66cee830bd423
Last active August 29, 2015 14:14
couple of directive
// angular.module('mymodule').directive('showAlertError', function() {
// return {
// restrict: 'E',
// scope: {
// key: '=key',
// alerts: '=alerts'
// },
// template: '<div ng-show="alerts.by_key[key]">{{alerts.by_key[key].message}}</div>',
// link: function(scope, elm, attrs) {

Keybase proof

I hereby claim:

  • I am nachinius on github.
  • I am nachinius (https://keybase.io/nachinius) on keybase.
  • I have a public key ASDX14QHFaIoW1xPDTq8XljRpLX_YJlJfXIsnFGaX-Te_go

To claim this, I am signing this object:

@nachinius
nachinius / CMakeLists.txt
Last active October 20, 2016 20:07
max heapify in C
cmake_minimum_required(VERSION 3.6)
project(algC)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c")
set(SOURCE_FILES main.c)
add_executable(algC ${SOURCE_FILES})
@nachinius
nachinius / sprayjsonInClasses.scala
Created August 25, 2017 12:38
Usage of spray json in Scala hierarchy of classes
import spray.json.JsonParser
val msg =
"""
| {"action":"move","data":{"direction":"left"}}
""".stripMargin
JsonParser(msg).asJsObject.getFields("action","data")(1).asJsObject.getFields("direction")
case class B(val afieldOfb: String)
@nachinius
nachinius / .travis.yml
Created December 13, 2017 01:59
scala with coveralls
language: scala
scala:
- 2.12.4
script:
- sbt clean coverage test coverageReport &&
sbt coverageAggregate
after_success:
- sbt coveralls
@nachinius
nachinius / Tree.scala
Created January 17, 2018 18:00
A simple tree sealed trait with K key and V value types, has eulertour and is traversable
sealed trait Tree[K, V] extends Traversable[Tree[K,V]] {
self =>
type Key = K
type Value = V
def eulerTourWithLevel[U, W, Y](level: Int)(in: Int => Tree[K, V] => U,
middle: Int => Tree[K, V] => W,
out: Int => Tree[K, V] => Y): Unit

Advanced Functional Programming with Scala - Notes

Copyright © 2016-2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@nachinius
nachinius / alpakka_on_2_11.sh
Created March 21, 2018 16:53
compile alpakka for 2.11
#!/bin/sh
find $HOME/.ivy2 -name "ivydata-*.properties" -print -delete
sbt -J-XX:ReservedCodeCacheSize=128m ++2.11.12 ";test:compile;docs/paradox"