Small help with immutable types...
// private readonly int _age;
// public int Age { get { return _age; } }
public int Age { get; }
const comparer = new Intl.Collator('ru', { numeric: true }).compare; | |
console.log(comparer('ф', 'в')); //returns -1, 0, 1 |
//+ Jonas Raoni Soares Silva | |
//@ http://raoni.org | |
// Iteration 3: manually minified xD | |
const sum = (...args) => ((v, r = sum.bind(this, v)) => (r[Symbol.toPrimitive] = () => v, r))(args.reduce((a, b) => a + b, 0)); | |
// Iteration 2: supports sum(1,2,3) | |
const sum = (...args) => { | |
const operation = (...args) => args.reduce((a, b) => a + b, 0); | |
let current = operation(...args); |
//+ Jonas Raoni Soares Silva | |
//@ http://raoni.org | |
using System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.Linq; | |
namespace JonasRaoni | |
{ |
[\x00-\x7F] # ASCII | |
|[\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | |
|\xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs | |
|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte | |
|\xED[\x80-\x9F][\x80-\xBF] # excluding surrogates | |
|\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | |
|[\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | |
|\xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 |
const condition = true; | |
// I don't know why, but adding an if here makes me sad since I started programming :L | |
condition ? 1 : -1; | |
// Alternative way 1 | |
(-1) ** condition; | |
// Alternative way 2 | |
2 * condition - 1; |
<?php | |
//+ Jonas Raoni Soares Silva | |
//@ http://raoni.org | |
class Lazy { | |
private $_cache; | |
private $_handler; | |
public function __construct(callable $handler) | |
{ |
//Split by nothing/position | |
'USDEUR'.split(/(?=\w{3}$)/); //["USD", "EUR"] | |
//Split without consuming/swallowing | |
'2020-10-10'.split(/(-)/); //["2020", "-", "10", "-", "10"] |
//+ Jonas Raoni Soares Silva | |
//@ http://raoni.org | |
<template lang="pug"> | |
span.field(@click.stop="") | |
input.is-checkradio( | |
v-bind="$attrs" | |
type="checkbox" | |
ref="checkbox" | |
:indeterminate.prop="status === null" |
registry=https://artifactory.example.com/api/npm/proxy_of_npm/ | |
//artifactory.example.com/api/npm/proxy_of_npm/:_authToken=SUPER_SECRET_KEY | |
//artifactory.example.com/api/npm/proxy_of_npm/:always-auth=true | |
//artifactory.example.com/api/npm/YOUR_PERSONAL_REPOSITORY/:_authToken=SUPER_SECRET_KEY | |
//artifactory.example.com/api/npm/YOUR_PERSONAL_REPOSITORY/:always-auth=true |