Skip to content

Instantly share code, notes, and snippets.

View vojtajina's full-sized avatar

Vojta Jina vojtajina

View GitHub Profile
@vojtajina
vojtajina / load_data.scala
Last active December 18, 2015 20:17
zeppelin-issue
val sqlContext = new org.apache.spark.sql.SQLContext(sc)
val testresults = sqlContext.read.json("/Users/vojta/Code/test.json")
testresults.registerTempTable("testresults")
testresults.printSchema()
// Output:
// sqlContext: org.apache.spark.sql.SQLContext = org.apache.spark.sql.SQLContext@5c927efe
// testresults: org.apache.spark.sql.DataFrame = [build: string, date: string, finished_epoch: double, first_failed_test_category: string, first_failed_test_error_string: string, first_failed_test_id: string, model: string, result_finished: string, result_started: string, root_test_category: string, root_test_id: string, status: string, tags: struct<mail_failure:boolean,product_failure:boolean,spotlight_failure:boolean,suggestd_failure:boolean>, train: string, uuid: string]
// root
// |-- build: string (nullable = true)
@vojtajina
vojtajina / generate-words.js
Last active May 28, 2023 20:51
Colemak/Tarmak Words Generator
#!/usr/bin/env node
// Tarmak 1
// var CHARS = 'nkej nkej nkejcb';
// Tarmak 2
// var CHARS = 'gtfj gtfj nkejcb';
// Tarmak 3
// var CHARS = 'jyo; jyo; jyo; gtfj nkejcb';
// Annotations can be put on:
// - functions / classes
// - function parameters
@Foo('bar')
function foo(@Baz() param1, @Baz() param2: Foo) {}
// GETS TRANSPILED INTO:
function foo() {}
// Using property getters, so that it works with circular references.
@vojtajina
vojtajina / types_playground.dart
Created October 7, 2014 17:16
Dart types in action
class Car {
start() {}
}
class Mustang extends Car {
startGasEngine() {
print('Starting gas engine.');
}
openWindow() {}
@vojtajina
vojtajina / foo.js
Last active August 29, 2015 14:07
Tracuer with es6-module-loader and systemjs
// Transpiled by
// ./node_modules/traceur/traceur --modules=instantiate
System.register("foo", [], function($__export) {
"use strict";
var __moduleName = "foo";
return {
setters: [],
execute: function() {
console.log('executing...');
}
@vojtajina
vojtajina / example.js
Created May 10, 2014 16:32
An example of Node core module bindings for DI.
import {module as nodeBindings} from './node_bindings';
import {Injector} from 'di';
import {Foo} from './foo';
var injector = new Injector(nodeBindings);
var foo = injector.get(Foo);
@vojtajina
vojtajina / di-simple-config.js
Created April 21, 2014 19:01
One possible way of doing configuration with DI. I think we need something nicer...
function Config() {
this.useFoo = false;
this.log = 'infoo;
}
@Inject(Config)
class SomeService{
constructor(config) {
// ...
@vojtajina
vojtajina / inject-helper.js
Created March 20, 2014 20:29
Annotations in ES5
// helper function, we can even ship these
define(['di/annotations'], function(annotations) {
var Inject = annotations.Inject;
var annotate = annotations.annotate;
return function inject(fn) {
var deps = Array.prototype.slice.call(arguments, 1);
var annotation = new Inject();
Inject.apply(annotation, deps);
@vojtajina
vojtajina / spec-one.js
Created February 21, 2014 01:52
Code example for Merrick.
it('should call append', inject($, MyUI, function(jQuery, ui) {
spyOn(jQuery, 'append');
ui.render();
expect(jQuery.append).toHaveBeenCalled();
});
@vojtajina
vojtajina / file-component.html
Created February 18, 2014 19:31
A tree example
<i class="file {{data.extension}}" on-click="emitClick()">
<span class="folder-name">{{data.basename}}</span>
</i>