Skip to content

Instantly share code, notes, and snippets.

View hitautodestruct's full-sized avatar

Yotam hitautodestruct

View GitHub Profile
@hitautodestruct
hitautodestruct / deepFreeze.js
Created December 23, 2021 09:06
A method for recursively freezing nested objects, for use with vuex store
function deepFreeze (object) {
if (object) {
// Retrieve the property names defined on object
var propNames = Object.getOwnPropertyNames(object)
// Freeze properties before freezing self
for (let name of propNames) {
let value = object[name]
object[name] = value && typeof value === 'object' ? DataMigration.deepFreeze(value) : value
@hitautodestruct
hitautodestruct / kermit.base64
Created August 1, 2019 08:06
kermit base64
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAEEAOEDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9+tlCptp1FABRRRQAUUUUAR0UUUAFFFFABRL3ool70AOTpTqQDAoY4FJuwC0jHAoDZqOSQ0ubS6Aj+07DgnHU5PAwD659KL2+W1t2kY7UTq2M/pX5Y/tlf8FIvjX+yZ+2/wCLtK1COLS/Ddw8J8O2V5Eklnf2iqE85JMruLtu3
@hitautodestruct
hitautodestruct / closeport.sh
Created June 4, 2019 10:03
MacOS How to close app that is taking up port
lsof -i :5000 # Search for app
(sudo) kill <PID>
@hitautodestruct
hitautodestruct / MultiRoot.vue
Last active April 10, 2019 12:03
Trying to cheat vue 2 into allowing multiple root components
<script>
export default {
name: 'MultiRoot',
functional: true,
render(h, { children }) {
return children.map(vnode => <components is={vnode.context.$options.name} />)
},
}
</script>
@hitautodestruct
hitautodestruct / reset.md
Created July 17, 2018 12:58
Reset root password on scaleway.com
@hitautodestruct
hitautodestruct / rsync.sh
Last active August 2, 2018 07:59
Synch files using rsync on mac
rsync -rav /source /destination
# in order to exlude files
rsync -rav --exclude=node_modules --exclude=.DS_Store /source /destination
@hitautodestruct
hitautodestruct / external.sh
Created July 12, 2018 11:40
cd into external hard disk macos terminal
cd /Volumes && ls
@hitautodestruct
hitautodestruct / shrinkpdf.sh
Created June 24, 2018 08:05
Reduce pdf file size on linux/osx cli
# !/bin/sh
# Possible values are: /screen, /ebook, /printer, /prepress
# https://www.techwalla.com/articles/reduce-pdf-file-size-linux
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -sOutputFile=output.pdf top-decor-prospect.pdf
@hitautodestruct
hitautodestruct / split_and_reassembale.sh
Created November 3, 2017 06:47
Split files cmd linux command
# Will split files into segment.aa, segment.ab in 100 megabyte chunks
split -b 100m myfile segment.
# To reassembale the pieces
cat segment.* > myfile
@hitautodestruct
hitautodestruct / vuejs-lodash-plugin.js
Created September 22, 2017 04:47
Vue js lodash plugin
//Original here - https://medium.com/@denny.headrick/mixins-and-plugins-in-vuejs-ecee9b37d1bd
//lodashPlugin.js
import _ from 'lodash';
let lodashPlugin = {};
lodashPlugin.install = function (Vue, options) {
Vue.prototype.$_ = _;