Skip to content

Instantly share code, notes, and snippets.

View x-raizor's full-sized avatar

Andrew Shapiro x-raizor

View GitHub Profile
@x-raizor
x-raizor / words-knock-together.rkt
Created February 15, 2022 21:31
Knock together words from the list pairwise
#lang racket
(define word-list (list "помада" "ревность" "сыр" "солнце" "трава"))
(define (words-knock-together word-list)
(when (> (length word-list) 1)
(map (lambda (x)
(displayln (string-append (first word-list) " " x))
;(displayln (string-append x " " (first word-list)))
) (rest word-list))
first_date_by_cmonth <- function(cmonth, base_year = 2017) {
require(magrittr)
require(dplyr)
require(purrr)
data.frame(
index = seq(1, length(cmonth)),
year = floor((cmonth - 1) / 12) + base_year,
month = cmonth %% 12,
@x-raizor
x-raizor / Scatterplot with marginal histograms.R
Created November 9, 2017 16:43
Scatterplot with marginal histograms
# Combine histogram scater and barchart in one plot
top_hist <- ggplot(dataset, aes(date, shipped)) + geom_col() +
theme(axis.ticks=element_blank(), panel.background=element_blank(),
axis.text.x=element_blank(), axis.title.x=element_blank(),
axis.title.y=element_blank())
right_hist <- ggplot(dataset) + geom_histogram(aes(shipped), binwidth = 1) + coord_flip() +
scale_x_continuous(expand=c(0, 0)) + scale_y_continuous(expand=c(0, 0)) +
theme(axis.ticks=element_blank(), panel.background=element_blank(),
axis.text.y=element_blank(), axis.title.y=element_blank()) + ylab('')
@x-raizor
x-raizor / tryCatch.R
Created August 28, 2017 19:19
tryCatch in R
urls <- c(
"http://stat.ethz.ch/R-manual/R-devel/library/base/html/connections.html",
"http://en.wikipedia.org/wiki/Xz",
"xxxxx"
)
readUrl <- function(url) {
out <- tryCatch(
{
# Just to highlight: if you want to use more than one
# R expression in the "try" part then you'll have to
@x-raizor
x-raizor / RandomHeight.sketchplugin
Created December 27, 2016 11:10
Quick Sketch Plugins // RandomHeight
// Random heights
var selectedLayers = context.selection;
var loop = [selection objectEnumerator];
while (layer = [loop nextObject]) {
layer.frame().setConstrainProportions(false);
var fNoise = 20 * Math.random();
layer.frame().setHeight(fNoise);
}
@x-raizor
x-raizor / dabblet.css
Created November 9, 2016 10:13
585 buttons
/**
* 585 buttons
*/
body {
background: #ffffff;
min-height: 100%;
text-align: center;
}
button {
height: 30px;
@x-raizor
x-raizor / dabblet.css
Last active November 3, 2016 18:39
585 buttons
/**
* 585 buttons
*/
body {
background: #ffffff;
min-height: 100%;
text-align: center;
}
button {
height: 30px;
@x-raizor
x-raizor / dabblet.css
Last active October 28, 2016 17:14
585 buttons
/**
* 585 buttons
*/
body {
background: #ffffff;
min-height: 100%;
text-align: center;
}
button {
height: 30px;
@x-raizor
x-raizor / dabblet.css
Created January 4, 2016 09:12
Button hover appearance test
/**
* Button hover appearance test
*/
html {
text-align: center;
font-family: Proxima Nova, san-serif;
background: #f06;
background: url('http://d.pr/i/10AsQ+');
min-height: 100%;
@x-raizor
x-raizor / dabblet.css
Last active October 22, 2015 12:41
Button hover appearance test
/**
* Button hover appearance test
*/
html {
text-align: center;
font-family: Proxima Nova, san-serif;
background: #f06;
background: url('http://d.pr/i/10AsQ+');
min-height: 100%;