Skip to content

Instantly share code, notes, and snippets.

View cezary's full-sized avatar

cezary cezary

  • Chicago / Los Angeles
View GitHub Profile
@cezary
cezary / copy-to-clipboard-bookmarklet.md
Created June 10, 2023 08:42 — forked from stefanmaric/copy-to-clipboard-bookmarklet.md
Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard

Copy-to-clipboard Bookmarklet

Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard.

This is the base javascript:

(function (text) {
  var node = document.createElement('textarea')
  var selection = document.getSelection()
# shortcuts
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"
alias p="cd ~/Projects"
# Get macOS Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g;'
# Google Chrome
alias chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
@cezary
cezary / iPod.swift
Created January 2, 2022 10:02 — forked from jordansinger/iPod.swift
Swift Playgrounds iPod Classic
import SwiftUI
import PlaygroundSupport
struct iPod: View {
var body: some View {
VStack(spacing: 40) {
Screen()
ClickWheel()
Spacer()
}
@cezary
cezary / solve24.js
Last active September 17, 2018 18:23
// https://stackoverflow.com/a/20871714
const permutator = (inputArr) => {
let result = [];
const permute = (arr, m = []) => {
if (arr.length === 0) {
result.push(m)
} else {
for (let i = 0; i < arr.length; i++) {
let curr = arr.slice();
// https://codepen.io/anon/pen/EpBJwR
const defaultOptions = { height: 100, width: 500 };
const generateSparkline = (data, options) => {
options = Object.assign({ defaultOptions, options });
const points = data.reduce((acc, [x, y], i) => {
x = (options.width / data.length) * i;
return acc + `${x},${options.height - y}\n`;
}, '');
const capitalize = word => word[0].toUpperCase() + word.slice(1).toLowerCase()
const abbreviate = (str, length=2) => {
str = str
.split(' ')
.map(word => word.toUpperCase() === word ? capitalize(word) : word)
.join(' ');
const ret = [];
str.replace(/([A-Z])/g, (match, p1) => {
const letterMap = {
"A": 2,
"B": 3,
"C": 5,
"D": 7,
"E": 11,
"F": 13,
"G": 17,
"H": 19,
"I": 23,
const animationFrame = () => new Promise(window.requestAnimationFrame);
const load = (el=window) => new Promise(resolve => el.onload = resolve);
const timeout = (time) => new Promise(resolve => setTimeout(resolve, time))
@cezary
cezary / statusapi.md
Created December 5, 2016 20:13 — forked from iansmith/statusapi.md
Explains the purpose of the YikYak status api and how to use it.

Purpose

The purpose of the Yik Yak status API is to allow a third-party application to set the status of a Yik Yak user programmatically. A secondary purpose is to allow a third-party application to set the location of the user (latitude, longitude), even though this is less likely to be less useful to most applications.

Mode Of Use