Skip to content

Instantly share code, notes, and snippets.

View botic's full-sized avatar
👔
working for @orfon and @diehauswirtschaft

Philipp Naderer-Puiu botic

👔
working for @orfon and @diehauswirtschaft
View GitHub Profile
.wrapper {
transform: perspective(1000px) rotateX(30deg);
position: absolute;
animation: crawl 20s linear 0s infinite;
margin: 0 auto !important;;
width: 800px;
}
@keyframes crawl {
from { top: 100px; }
@botic
botic / first-reactive-steps.js
Created December 7, 2015 19:27
First Reactive Steps
const Rx = require("rx");
const dates = require("ringo/utils/dates");
// very simple
const a$ = Rx.Observable.of(1,2,3);
a$.subscribe(function(x) { console.log("a$", x); });
// a little bit more complex
const start = new Date();
@botic
botic / terminal.js
Last active December 7, 2015 12:20
RingoJS - Iterators and Generators
Philipps-MBP:~ philipp$ ringo
>> function* foo(a) { a = a + 1; yield a; }
SyntaxError: missing ( before function parameters.
<stdin>, line 14: missing ( before function parameters.
function* foo(a) { a = a + 1; yield a; }
^
>> function foo(a) { a = a + 1; yield a; }
>> var x = foo(1);
>> x.next();
2
@botic
botic / main.js
Last active November 4, 2015 14:53
Ringo HTTP Server docs
var {Server} = require("ringo/httpserver");
var server = new Server();
/* First way: directly providing a function
server.getDefaultContext().serveApplication(function(req) {
return {
status: 200,
headers: {},
@botic
botic / google-safeharbor-eugh.md
Last active October 15, 2015 08:43
Google Mail to Customers

Please note this email is relevant to you only if you are using Google Cloud Platform to process personal data and European Data Protection laws apply to that processing.

Hello Google Cloud Platform Customer,

The recent ruling by the Court of Justice of the European Union (CJEU) declaring the European Commission’s decision on US-EU Safe Harbor framework to be invalid is an important development in the area of data protection. You can expect our full support as we work together to address this development, as there is nothing more important to us than your trust, privacy and security. We are awaiting more information from the European Commission (EC) and data protection authorities regarding their responses to the court decision.

The European Commission and the US have been actively working on a revised Safe Harbor agreement that should address these concerns, but they were unable to finalize the new agreement prior to the court ruling. Both have indicated that they want to finalize the new Safe Harbor f

exports.formatPercent = function(value, notation) {
switch (notation) {
case "floating": {
let remainder = Math.round((value * 10000) % 100);
return Math.floor(value * 100) + (remainder !== 0 ? ("," + (remainder < 10 ? "0" : "") + remainder) : "");
}
case "human": {
let remainder = Math.round((value * 100) % 100);
return Math.floor(value) + (remainder !== 0 ? ("," + (remainder < 10 ? "0" : "") + remainder) : "");
}
@botic
botic / alpbuzz-credits.js
Last active August 29, 2015 14:27
Credits for Alpbuzz
// ==UserScript==
// @name Alpbuzz Credits
// @namespace naderer.alpbuzz
// @include http://www.alpbach.org/alpbuzz*
// @version 1
// @grant none
// ==/UserScript==
(function(jQuery) {
// do not apply on frontpage
@botic
botic / fs-converter.js
Last active August 29, 2015 14:25
Ringo to NIO
var assert = require("assert");
var octalToString = function(octalPart) {
switch (octalPart) {
case 0: return "---";
case 1: return "--x";
case 2: return "-w-";
case 3: return "-wx";
case 4: return "r--";
case 5: return "r-x";
@botic
botic / httpsconnection.js
Created July 9, 2015 08:02
TLS/SSL with Ringo's HTTP client
var {get, request} = require("ringo/httpclient");
// Using get
var exchange = get("https://www.washingtonpost.com/");
console.log(exchange.status);
// Using the more generic request function
exchange = request({
url: "https://www.washingtonpost.com/",
method: "GET"
@botic
botic / ofyToObject.js
Created April 16, 2015 10:21
Objectify Entity to Plain JS Object in Rhino
const OBJECT_CLASS = (new java.lang.Object()).getClass();
var ofyToObject = exports.ofyToObject = function(ofyObject) {
let obj = {};
let beanInfo = java.beans.Introspector.getBeanInfo(ofyObject.getClass(), OBJECT_CLASS);
let properties = beanInfo.getPropertyDescriptors();
for (let i = 0; i < properties.length; i++) {
let pd = properties[i];
let getter = pd.getReadMethod();