This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# - Store refresh token on Redis under one_drive:refresh_token | |
# - Do OneDrive::Client.new.upload_file('/path/to/file') | |
module OneDrive | |
class Client | |
REFRESH_TOKEN = 'one_drive:refresh_token'.freeze | |
class NoTokens < StandardError; end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ncurses' | |
class BouncingBug | |
FRAMES_PER_SECOND = 4 | |
TIME_BETWEEN_FRAMES = 1.0 / FRAMES_PER_SECOND | |
attr_reader :scr | |
def initialize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
************************* | |
IDENTIFICATION DIVISION. | |
************************* | |
PROGRAM-ID. PRV34915. | |
***************************************************************** | |
* * | |
* DEPARTAMENTO PRE-VALIDACION DE DECLARACIONES * | |
* DE DEL MODELO 349. EJERCICIO 2015 * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TaxCalc | |
TABLAS = { | |
retenciones_es: { | |
5550 => 0, | |
12450 => 19, | |
20200 => 24, | |
35200 => 30, | |
60000 => 37, | |
999999 => 45 | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require 'active_support/core_ext/string/strip' | |
class MyClass | |
def call | |
"this is\na pretty\n(¯`·._.·[ string ]·._.·´¯)\n" | |
end | |
end | |
describe MyClass do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* domainSuggestions shows a list of domain suggestions… for email. | |
* | |
* Inspired by autoEmail http://www.cxpartners.co.uk/cxblog/towards-an-easier-way-to-enter-email-addresses/ | |
* which is based upon https://github.com/chrisyuska/auto-email | |
*/ | |
(function($) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
Colorbox 1.6.1 | |
license: MIT | |
http://www.jacklmoore.com/colorbox | |
HT modifications: | |
- simpler photo counter | |
- inlined svg controls | |
- prev, next, close positioned to the browser window | |
- close button is always visible |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100.times do |i| | |
out = '' | |
out << 'fizz' if (i%3).zero? | |
out << 'buzz' if (i%5).zero? | |
out << i.to_s if out.empty? | |
puts out | |
end |
RxJS and Bacon.js equivalences:
Bacon.js | RxJS | |
---|---|---|
Create stream for keyup events from an element | var inputText$ = $([data-js=my-input]).asEventStream('keyup').map('.target.value'); | var inputText$ = Rx.Observable.fromEvent($('[data-js=my-input]'), 'keyup').pluck('target', 'value') |
Create stream for keyup events from a live element | var inputText$ = $(document).asEventStream('keyup', '[data-js=my-input]').map('.target.value'); | var inputText$ = Rx.Observable.create(function(observer) {$(document).on('keyup', '[data-js=my-input]', function(e) {observer.onNext(e.target.value);});}); |
Subscribe to a stream | inputText$.onValue(function(props) {…}); | inputText$.subscribe(function(props) {…}); |
Create stream from promises | Bacon.fromPromise($.get(url, {text: text})); | Rx.Observable.fromPromise($.get(url, {text: text})); |
NewerOlder