Skip to content

Instantly share code, notes, and snippets.

View scriptype's full-sized avatar
🍁

Mustafa Enes Ertarhanaci scriptype

🍁
View GitHub Profile
@scriptype
scriptype / new text file
Last active September 15, 2023 14:16
Create a new text file in the current finder directory on mac
-- Usage:
-- Open Automator
-- Choose to create an "Application"
-- Find "AppleScript" and drag it to the right side
-- Copy the code below
-- Save the app
-- While holding option+command, drag the app icon to finder top toolbar
tell application "Finder"
set folderPath to quoted form of POSIX path of (the target of the front window as text)
@scriptype
scriptype / dependencies.js
Created December 19, 2022 16:17
iceblue-deneme
/*! jQuery v3.6.2 | (c) OpenJS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,y=n.hasOwnProperty,a=y.toString,l=a.call(Object),v={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},S=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||S).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?
@scriptype
scriptype / save.js
Last active December 22, 2021 21:28
function save({
initialInvestment = 0,
baseMonthly,
contributionChangePercentageYearly,
contributionChangeFn,
returnPercentageYearly,
durationYears,
accumulatedExpense = 0,
accumulatedValue = 0,
values = [],
@scriptype
scriptype / render-buttons.js
Created September 11, 2020 10:18
Rendering 20 buttons with indexes
const renderComponent = (component, parentNode, method = 'append') => {
if (method === 'append') {
parentNode.appendChild(component.element)
} else {
// To be implemented
}
if (component.props.onClick) {
component.element.addEventListener('click', component.props.onClick)
}
if (component.props.onFocus) {
@scriptype
scriptype / find_unused.sh
Last active September 5, 2020 12:09
Find unused tsx files
# It will print all file names (without extension)
# and list all files (their full paths) that reference those files inside an import statement
#
# It may and most likely will find false negatives (files that are actually used),
# so double-checking those files before deleting them is needed.
find src -name '*.tsx' \
| awk -F/ '{print $NF}' \
| awk -F. '{print $1}' \
| xargs -I _ sh -c "echo '\nFile: _' && grep --recursive --include='*.tsx' -isw 'from .\+_\"' src | awk '{ print $1 }' | cut -d':' -f1 | uniq" \
| less
@scriptype
scriptype / index.html
Created May 7, 2020 02:55
Park Street 11 - 3D CSS
<div class="wall">
<div class="wall-rain-shield"></div>
<div id="wall-half-vertical-tiles">
<div class="left-shadow"></div>
</div>
<div id="wall-masonry-vertical-tiles">
<div class="left-shadow"></div>
@scriptype
scriptype / encode-and-decode.js
Last active March 15, 2020 21:54
Simplest image encoding ever: building binary strings from rgb values
var randomInteger = (max = 1) => Math.round(Math.random() * max)
var nArrayOf = (n, ofWhat) => [...Array(n).keys()].map(ofWhat)
var zeroPad = (value = '', n = 8) => `${value}00000000`.slice(0, n)
var splitBy = (string = '', by = 8) => {
var result = []
for (var i = 0; i < string.length; i += by) {
result.push(string.slice(i, i + by))
function defensive() {
function initialState() {
return {
toEscape: 25,
escaping: false,
health: health()
};
}
const Duck = {
navigator.requestMIDIAccess()
.then(onMIDISuccess, onMIDIFailure);
function onMIDIFailure() {
console.log('Could not access your MIDI devices.');
}
function onMIDISuccess(midiAccess) {
console.log(midiAccess);
@scriptype
scriptype / gist:62a521c771293aefe89b3228ac98aa45
Last active January 31, 2019 09:42
Overlap bitmaps (WIP)
var colors = {
0: 'transparent',
1: 'white',
2: '#aaa'
}
var planetMap = [
[ 0, 0, 1, 9, 1 ],
[ 0, 0, 1, 8, 1 ],
[ 1, 1, 1, 7, 1 ],