Skip to content

Instantly share code, notes, and snippets.

View skoshy's full-sized avatar
🙃
Probably starting a new side project

Stefan K skoshy

🙃
Probably starting a new side project
View GitHub Profile
<?
/*
* How to Use
*
* Supply a message to encrypt, optionally supply a salt as well, otherwise a random one will be created
* Salt MUST be 22 characters to work reliably
* You will receive an array with $arr['salt'] being the salt and $arr['digest'] being the encrypted result
*/
<?
/*
Using filter_var and check the domain part contains a dot
From http://www.electrictoolbox.com/php-email-validation-filter-var-updated/
Check link for a series of tests
*/
function emailValidate($email) {
return filter_var($email, FILTER_VALIDATE_EMAIL) && preg_match('/@.+\./', $email);
@skoshy
skoshy / isFalsy.js
Last active November 1, 2024 07:48
Determines if any value is "falsy" in JavaScript
// this function takes in any parameter and can tell if it's "falsy" or not.
// falsy means it's either false, 0, null, undefined, NaN, or an empty string/array/object
// see the test cases at the bottom for a clearer picture
function isFalsy(item) {
try {
if (
!item // handles most, like false, 0, null, etc
|| (
typeof item == "object" && (
@skoshy
skoshy / cutSubstr.js
Created May 3, 2017 17:21
Cuts a substring from a string based on a leading/trailing string
/*
Example - https://codepen.io/skoshy/pen/jmLyRm
leading = string, or blank string '' which signifies first character
trailing, string, or blank string '' which signifies last character
*/
function cutSubstr(string, leading, trailing) {
let substr = '';
// first, let's get the primary index
@skoshy
skoshy / Graph.js
Created May 6, 2017 16:00
Basic graph for JS
/* Modified from http://blog.benoitvallon.com/data-structures-in-javascript/the-graph-data-structure/ */
function Graph() {
this.vertices = [];
this.edges = [];
this.numberOfEdges = 0;
this.addVertex = function(vertex) {
this.vertices.push(vertex);
this.edges[vertex] = [];
@skoshy
skoshy / OpenWithSublimeText3.bat
Created June 17, 2017 23:42 — forked from byBretema/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 10)
@echo off
SET st3_path=C:\Program Files\Sublime Text 3\sublime_text.exe
SET st3_label=Open with Sublime Text 3
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "%st3_label%" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3_path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3_path% \"%%1\"" /f
rem add it for folders
@skoshy
skoshy / .treehouse
Last active August 1, 2017 19:08 — forked from ErikGartner/.treehouse
dTree Demo
1.3.1

Keybase proof

I hereby claim:

  • I am skoshy on github.
  • I am skoshy (https://keybase.io/skoshy) on keybase.
  • I have a public key ASBtmxmQjuASNdVEtNxQu39RyWhi8uqCUXgxe7rGi4Gi2go

To claim this, I am signing this object:

#####
# Remember to `brew install reattach-to-user-namespace` for working copy support
# Also install tpm - git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# and then install tpm plugins - https://github.com/tmux-plugins/tpm#installing-plugins
#####
# Plugins
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'