Skip to content

Instantly share code, notes, and snippets.

View scriptype's full-sized avatar
🍁

Mustafa Enes Ertarhanaci scriptype

🍁
View GitHub Profile
@scriptype
scriptype / Rotate bitmap
Last active November 15, 2018 23:48
Rotate bitmap
var asset = {
bitmap: [
`A A A B B B`,
`A . . . . B`,
`A . 1 1 . B`,
`D . 2 2 . C`,
`D . . . . C`,
`D D D C C C`
].map(row => row.split(' ')),
size: 6
@scriptype
scriptype / index.html
Created November 8, 2018 21:38
sin(round(random()))
<canvas id="canvas"></canvas>
@scriptype
scriptype / example.js
Last active June 20, 2018 23:18
take(): Switch-case as an expression
/*
* It takes an expression and a handler object
* that consists of potential actual values of
* the given expression.
*
* The function calls either the
* matching method or the default defined in
* handler object (if defined).
*/
function take(expression, handler) {
@scriptype
scriptype / renderCategories.js
Created March 20, 2018 13:46
Traverse deep categoryTree recursively
function rootTemplate(categories) {
return `
<div class="root-container">
${ getCategoryMarkup(categories) }
</div>
`
}
function itemsTemplate(items, level) {
return `
@scriptype
scriptype / index.html
Last active March 12, 2018 21:49
vREqpz
<canvas id="canvas"></canvas>
@scriptype
scriptype / genetic.js
Created February 22, 2018 22:03
Hello world example with genetic algorithm
(() => {
function nArray(n, mapperFn) {
return new Array(n).join(' ').split(' ').map(mapperFn)
}
function getRandomString(length) {
return nArray(length, e =>
String.fromCharCode(Math.round(Math.random() * 126))
).join('')
}
@scriptype
scriptype / pronounce-words-with-espeak.vim
Created May 25, 2017 02:17
Pronounce words in Vim using `espeak` instead of `say`
nnoremap <silent> <leader>s :<C-u>call system('espeak ' . expand('<cword>'))<CR>
@scriptype
scriptype / say-word-edited-after-feedbacks.vim
Last active May 25, 2017 02:11
Pronounce a word in Vim (Edited accordingly after feedbacks)
nnoremap <silent> <leader>s :<C-u>call system('say ' . expand('<cword>'))<CR>
@scriptype
scriptype / retrieve-from-s-register.vim
Last active May 24, 2017 05:35
Retrieve contents of s register
<C-r>s