Skip to content

Instantly share code, notes, and snippets.

View wachunei's full-sized avatar
🧔
being

Pedro Pablo Aste Kompen wachunei

🧔
being
View GitHub Profile
@wachunei
wachunei / rut.rb
Last active August 29, 2015 14:10
RUT Chile: obtener dígito verificador, validar y formatear
def obtener_dv rut
rut = rut.to_s.tr(".-", "").reverse
suma = 0
for index in 0..rut.size
suma+= rut[index].to_i * (2+index%6)
end
res = 11 - suma % 11
res = (res == 11)? 0 : (res == 10)? "K" : res
res.to_s
end
@wachunei
wachunei / numeric_for_django_templates.html
Last active October 27, 2022 13:41
Numeric for loop in Django Templates
<!-- Iterate N times (replace N with a number -->
{% for i in "x"|ljust:"N" %}
<!-- Access numeric variable (0-based index) -->
{{ forloop.counter0 }}
<!-- Access numeric variable (1-based index) -->
{{ forloop.counter }}
{% endfor %}
<!-- For example, iterate from 0 to 3 -->
@wachunei
wachunei / cherylbd.rb
Last active August 29, 2015 14:19
Cheryl Birthday Ruby
def print_dates(dates, answer_text)
puts "\nAnswers left:" if answer_text
puts dates.join("; ")
print "\n"
end
class Day
attr_accessor :month, :day
def initialize(month, day)
@day = day;
@wachunei
wachunei / main.js
Last active September 4, 2015 14:05 — forked from lopezjurip/main.js
Repartidor web js
var turn = 0;
var teams = ['Rupie', 'TheTeam', 'Veritas', 'ImaginApp', 'Nebuchadnezzar', 'InternalServerError'];
var patoTeams = ['YisusPlusOne', 'ZipCity2000', 'tqzptscsaj'];
var pedroTeams = ['String.random','ToPa'];
var thomasTeams = ['LosExtraterrestresMusicales', 'Rock and Prog', 'PW:Software'];
var result = teams.sort(function(){return 0.5 - Math.random();})
.reduce(function(previous, current) {
previous[['pato', 'thomas', 'pedro'][turn++ % 3]].push(current);
return previous;

Keybase proof

I hereby claim:

  • I am wachunei on github.
  • I am wachunei (https://keybase.io/wachunei) on keybase.
  • I have a public key whose fingerprint is 1FF2 2D06 C083 F214 8242 F57F A224 5E15 6775 F068

To claim this, I am signing this object:

@wachunei
wachunei / withDebounce.js
Created January 12, 2018 15:27
withDebounce HOC
import React from 'react';
import PropTypes from 'prop-types';
import debounce from 'lodash/debounce';
const withDebounce = (Touchable) => {
class DebouncedComponent extends React.PureComponent {
constructor(props) {
super(props);
const { onPress } = props;
this.onPress = debounce(() => onPress && onPress(), 300, {
@wachunei
wachunei / AnimatedGate.jsx
Last active December 12, 2019 06:01
Replicating Twitter iOS splash screen animation on React Native during redux rehydration
import React, { Component } from 'react';
import { Animated, Easing, StatusBar, MaskedViewIOS, View } from 'react-native';
class AnimatedGate extends Component {
constructor(props) {
super(props);
this.beginAnimation = this.beginAnimation.bind(this);
this.state = {
animation: new Animated.Value(0),
};
@wachunei
wachunei / .eslintignore
Last active July 27, 2020 03:45
Fintual Goals Profit Tooltip
!.eslintrc.js
@wachunei
wachunei / .eslintignore
Last active May 11, 2022 14:14
Fintual Goal Profit Home
!.eslintrc.js
@wachunei
wachunei / ✨ Ñoñerías para Fintual.md
Last active January 19, 2022 23:02
Una recopilación de ñoñerías chicas que he hecho como usuario de Fintual

✨ Ñoñerías para Fintual

Una recopilación de ñoñerías chicas que he hecho como usuario de Fintual.

Importante: no formo parte del equipo de fintual, todo lo que está acá no es responsabilidad de ellos. Todo lo que está acá puede fallar si el sitio o API de fintual cambia.


Contenido