Skip to content

Instantly share code, notes, and snippets.

Piotr Mionskowski miensol

Block or report user

Report or block miensol

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
@miensol
miensol / generator_simple.harmony.js
Created Jun 14, 2014
generator receiving exceptions
View generator_simple.harmony.js
var catchingGenerator = function *(){
console.log('I will stop when you tell me about error');
var error = null;
while(error === null){
try {
var value = yield null;
console.log("Got value from you: %s", value);
}catch(e){
error = e;
}
View generator_simple.harmony.js
var fibo = function *(){
var a = 0,
b = 1;
yield a;
yield b;
while(true){
var next = a + b;
yield next;
a = b;
View generator_simple.harmony.js
var oracle = function *(){
var question = yield "Hello";
while(question != "Bye!"){
var answer = Math.random();
console.log(question, "oracle says: ", Math.random());
question = yield answer;
}
console.log("Thank you!")
};
View generator_simple.harmony.js
var sequence = function *() {
yield 1;
yield 2;
};
var sequenceGenerator = sequence();
var current = null;
current = sequenceGenerator.next();
console.log(current);
current = sequenceGenerator.next();
console.log(current);
@miensol
miensol / generator_simple.harmony.js
Last active Aug 29, 2015
linq samples using es6 generators
View generator_simple.harmony.js
var Linq = function (inner){
var that = this;
this.toArray = function(){
var result = [];
for(var item of inner()){
result.push(item);
}
return result;
};
@miensol
miensol / generator_simple.harmony.js
Created Jun 14, 2014
generator throwing excaptions
View generator_simple.harmony.js
var throwing = function *(){
console.log('Generator entered, yielding first value');
yield 1;
console.log('Generator asked for second value - will go bum');
throw new Error("You can only call this generator once, sorry!");
console.log('Will never get here');
yield 3;
};
var throwingGenerator = throwing();
View designer.html
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../paper-radio-group/paper-radio-group.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
<link rel="import" href="../paper-input/paper-input.html">
<polymer-element name="my-element">
<template>
View SortableFragmentStatePagerAdapter.java
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@miensol
miensol / count_in_json_aray.sql
Created Sep 29, 2014
Count elements in json array
View count_in_json_aray.sql
select count(ja.id), elem.value::varchar from
json_answer ja,
json_array_elements(ja.answer) as elem
group by elem.value::varchar
@miensol
miensol / play_services.txt
Created Dec 8, 2014
Google Play Services - dex method counts
View play_services.txt
/play-services/3.1.36/play-services-3.1.36.aar
Read in 5931 method IDs.
<root>: 5931
: 1
android: 374
accounts: 2
app: 33
content: 77
pm: 5
res: 14
You can’t perform that action at this time.