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
function leftPad(str, len, ch) { | |
ch = !ch || ch !== 0 ? ' ' : ch; | |
for (let i = 0; i < len - str.length; i++) str = ch + str; | |
return str; | |
} | |
function leftPad2(str, len, ch) { | |
str = String(str); | |
let i = -1; | |
if (!ch || ch !== 0) ch = ' '; |
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
cmake_minimum_required(VERSION 3.24) | |
project(studia) | |
set(CMAKE_CXX_STANDARD 23) | |
find_package(GTest REQUIRED) | |
enable_testing() | |
include_directories(${GTEST_INCLUDE_DIRS}) | |
add_executable(studia main.cpp) |
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
// shared/auth/src/lib.rs | |
// The MIT License (MIT) | |
// Copyright (c) 2021 Tsumanu | |
// Access token with Bearer | |
use std::future::Future; | |
use std::rc::Rc; |
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
# .config/sway/config | |
set $mod Mod4 | |
set $left h | |
set $down j | |
set $up k | |
set $right l | |
set $term alacritty | |
set $menu BEMENU_BACKEND=wayland bemenu-run --fn $uifont -b -p "▶" --tf "$prompt" --hf "$highlight" --sf "$highlight" --scf "$highlight" | xargs swaymsg exec |
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
#![feature(test)] | |
extern crate test; | |
use std::collections::HashMap; | |
use std::env::args; | |
use std::fs::File; | |
use std::io::{self, BufRead}; | |
use num_bigint::BigUint; |
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
/* always use lodash! https://lodash.com/ */ | |
module.exports = { | |
entry: { | |
vendor: ['react', 'react-redux', 'redux', 'moment', 'lodash'], | |
main: 'your-main' | |
}, | |
output: { | |
path: path.join(root, 'dist'), | |
filename: '[name].[hash].js', | |
chunkFilename: '[id].css', |
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
function randn_bm(min, max, skew) { | |
var u = 0, v = 0; | |
while(u === 0) u = Math.random(); //Converting [0,1) to (0,1) | |
while(v === 0) v = Math.random(); | |
let num = Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v ); | |
num = num / 10.0 + 0.5; // Translate to 0 -> 1 | |
if (num > 1 || num < 0) num = randn_bm(min, max, skew); // resample between 0 and 1 if out of range | |
num = Math.pow(num, skew); // Skew | |
num *= max - min; // Stretch to fill range |
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
import { DELETE_FILE_ENTITY, GET_FILE_ENTITIES, GET_FILE_ENTITY } from "./types"; // NO! | |
import * as types from "./types"; // YES | |
// NO! | |
export const getFile = filename => { | |
const res = await axios.get(`http://localhost:8080/api/files/${filename}`); | |
dispatch({ | |
type: GET_FILE_ENTITY, | |
payload: res.data | |
}); |
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
sudo apt-get install fish | |
curl -L https://get.oh-my.fish | fish | |
omf install apt bundler gem rails rustup rvm android-sdk git-status sdk |