Skip to content

Instantly share code, notes, and snippets.

View Somesa's full-sized avatar

Somesa Somesa

  • SSZ Agency
  • Roubaix
View GitHub Profile
@Somesa
Somesa / ID.js
Created March 22, 2021 15:06
ID - a unique ID/name generator for JavaScript
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`
@giventofly
giventofly / scroll into.js
Last active December 11, 2023 06:53
scroll to element vanilla js
//from https://css-tricks.com/snippets/jquery/smooth-scrolling/
// Scroll to specific values
// scrollTo is the same
window.scroll({
top: 2500,
left: 0,
behavior: 'smooth'
});
@jaakkolehtonen
jaakkolehtonen / oh-my-zsh-custom-installation.sh
Last active March 19, 2021 00:22
Custom @ohmyzsh installation which keeps ~/.zshrc in sync via @dropbox
# Create hidden folder for Oh My Zsh core installation with subfolders for custom plugins and themes
mkdir -p ~/.zsh/custom/{plugins,themes}
# Clone Oh My Zsh from Github into root of hidden ~/.zsh directory
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.zsh/oh-my-zsh
# Clone Powerlevel9k theme to ~/.zsh/custom/themes folder
git clone https://github.com/bhilburn/powerlevel9k.git ~/.zsh/custom/themes/powerlevel9k
# Fetch and install Nerd Font from Github to be used with our new shell config (http://nerdfonts.com/#downloads), long script but does the job :)
@rmatil
rmatil / gist:8d21620c11039a442964
Created March 25, 2015 13:39
Connect MySQL database in Vagrant VM from Host machine

Connecting to Vagrant VM MySQL database from host

This gist shows how to connect to your vagrant MySQL database from the host machine.

Change Address Binding from MySQL

  • Connect to vagrant using vagrant ssh
  • Edit file /etc/mysql/my.cnf:
    • Change parameter bind-address to 0.0.0.0 to allow all incoming connection attempts
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/