This file contains 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
use std::collections::HashMap; | |
fn mean(arr: &Vec<usize>) -> usize { | |
let sum = arr.iter().fold(0, |sum, el| sum + el); | |
sum / arr.len() | |
} | |
fn median(arr: &Vec<usize>) -> usize { | |
let half_position = arr.len() / 2; | |
let mut input_sorted = arr.clone(); |
This file contains 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
const quotientFunctions = { | |
year: time => Math.floor(time / (365 * 24 * 60 * 60)), | |
day: time => Math.floor((time / (24 * 60 * 60)) % 365), | |
hour: time => Math.floor((time / (60 * 60)) % 24), | |
minute: time => Math.floor((time / 60) % 60), | |
second: time => Math.floor(time % 60), | |
}; | |
const pluralize = ({ | |
str, | |
quotient |
This file contains 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
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+ |
This file contains 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
let apiResponse = await fetch('https://swapi.co/api/people/1') | |
let swCharacterObject = await apiResponse.json() | |
console.log(swCharacterObject.name) |
This file contains 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
const CYBER_MIN_DURATION = 30; | |
const CYBER_MAX_DURATION = 70; | |
const CYBER_CHARS = [...`10!@#$%*()£¢¬{[]}^<>.;:?/|\\-_=+§`]; | |
const random = max => parseInt(Math.random() * max); | |
const randomRange = (a, b) => a + random(b - a); | |
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
const randomElem = arr => arr[random((arr.length - 1))]; | |
const range = num => [...Array(num).keys()]; | |
const changeCharFromPos = (text, char, pos) => text.substring(0, pos) + char |
This file contains 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
const { S3 } = require('aws-sdk'); | |
const { promisify } = require('util'); | |
const main = async () => { | |
const s3 = new S3(); | |
const s3ListPromise = async params => promisify(s3.listObjectsV2).bind(s3)(params); | |
const listObjects = async (Bucket, Prefix) => s3ListPromise({ | |
Bucket, |
This file contains 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
// find all elements with a z-index and indicate what they are. | |
// uses css outline which is not supported in IE <8 | |
function contrast(color){ return '#' + | |
(Number('0x'+color.substr(1)).toString(10) > 0xffffff/2 ? '000000' : 'ffffff'); | |
} | |
jQuery('*') | |
.filter(function(){ return $(this).css('zIndex') !== 'auto'; }) | |
.each(function(){ |
This file contains 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
module Concerns | |
module Models | |
module Publishable | |
extend ActiveSupport::Concern | |
included do | |
REJECTED = -1 | |
PENDING = 0 | |
PUBLISHED = 1 |
This file contains 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
<template> | |
<section> | |
<h1>{{title}}</h1> | |
<ul> | |
<li v-for="elem in list" :key="elem.id"> | |
{{ elem.name }} | |
</li> | |
</section> | |
</template> |
This file contains 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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
NewerOlder