Skip to content

Instantly share code, notes, and snippets.

View rpunkfu's full-sized avatar

Oskar Cieslik rpunkfu

View GitHub Profile
@rpunkfu
rpunkfu / michal-3.js
Last active September 21, 2016 12:16
import React, { Component } from 'react';
class Button extends Component {
constructor(props) {
super(props);
this.color = 'blue';
}
render() {
return <button class={`button-${this.color}`}>Click me</button>
@rpunkfu
rpunkfu / michal-2.js
Last active September 21, 2016 12:16
import React, { Component } from 'react';
class MyComponent extends Component {
constructor(props) {
this.firstName = props.firstName;
this.lastName = props.lastName;
this.url = props.url;
}
render() {
@rpunkfu
rpunkfu / michal-1.js
Last active September 21, 2016 12:16
import React, { Component } from 'react';
class MyComponent extends Component {
constructor(props) {
this.state = {
clicks: 0
};
}
componentDidMount() {
foo = (element, $timeout) ->
$timeout ->
bindElement = element
isSwitchElement = -> element[0].scrollWidth == undefined && scope.field?.type == 'text'
bindElement = element.next() if isSwitchElement(element)
scope.tooltipEnabled = bindElement[0].scrollWidth > bindElement[0].offsetWidth
@rpunkfu
rpunkfu / generators-intro.js
Created April 21, 2016 19:18
articles/generators/generators-intro
function* KindBotGenerator() {
const prompt = 'Hello, what\'s your name?';
const answer = yield prompt;
return `Hello, ${answer}! :)`;
}
const kindBot = KindBotGenerator();
console.log(kindBot.next().value); // Hello, what's your name?
@rpunkfu
rpunkfu / generators-intro.js
Last active April 21, 2016 18:57
articles/generators/intro
function* KindBotGenerator() {
const prompt = 'Hello, what\'s your name?';
const answer = yield prompt;
return `Hello, ${answer}! :)`;
}
const kindBot = KindBotGenerator();
console.log(kindBot.next().value); // Hello, what's your name?
@rpunkfu
rpunkfu / generators.js
Last active April 22, 2016 22:16
articles/generators/generators
import request from 'request';
import bluebird from 'bluebird';
const ronQuotesAPI = 'https://ron-swanson-quotes.herokuapp.com/v2/quotes';
const extractText = quote => JSON.parse(quote.body)[0];
const asyncRequest = bluebird.promisifyAll(request);
const getRonQuotes = bluebird.coroutine(function* () {
const quotes = [];
@rpunkfu
rpunkfu / promises.js
Last active April 22, 2016 22:16
articles/generators/promises
import request from 'request';
import bluebird from 'bluebird';
const ronQuotes = 'https://ron-swanson-quotes.herokuapp.com/v2/quotes';
const extractText = quote => JSON.parse(quote.body)[0];
const asyncRequest = bluebird.promisifyAll(request);
const getRonQuotes = () => {
const quotes = [];
@rpunkfu
rpunkfu / callbacks.js
Last active April 22, 2016 22:17
articles/generators/callbacks
import request from 'request';
const ronQuotes = 'https://ron-swanson-quotes.herokuapp.com/v2/quotes';
const extractText = quote => JSON.parse(quote.body)[0];
const getRonQuotes = (cb) => {
const quotes = [];
request.get(ronQuotes, (err1, res1) => {
if (err1) throw Error(err1);
@rpunkfu
rpunkfu / .pylintrc
Created December 15, 2015 19:07
Pylint's config file based on Google Style Guide for Python
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Add files or directories to the blacklist. They should be base names, not