Skip to content

Instantly share code, notes, and snippets.

@tsur
tsur / mysql_osx
Last active October 28, 2015 20:49
Setup mysql on osx (no signing in needed)
#!/bin/bash
#############################################
# DESC: THIS SCRIPT INSTALLS MySQL on OSX #
#############################################
#REQUIREMENTS:
# OS X 10.7 or newer
#############################################
# CHECK FOR OS X 10.7+
# NOTE: To reset password: enter temporal password
# /usr/local/mysql/bin/mysql -u root -p
@tsur
tsur / disable_cors_on_chrome.sh
Last active February 13, 2016 13:15
chrome browser disable CORS
# OSX
$ open -a Google\ Chrome --args --disable-web-security
# Linux
$ google-chrome --disable-web-security
# Also if you're trying to access local files for dev purposes like AJAX or JSON, you can use this flag too .
-–allow-file-access-from-files
# Window
@tsur
tsur / index.html
Created August 16, 2015 19:50
magen-david
<div class="rotation-slider">
<input type="range" min="0" max="10" step="0.1" value="0">
<p></p>
</div>
<canvas/>
@tsur
tsur / dots-world.markdown
Created August 15, 2015 23:28
dots-world
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
# Add to bash_profile
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# Create a ~/.gitconfig file containing
[diff]
@tsur
tsur / deleteNotEnding
Last active August 29, 2015 14:23
Delete all files not ending
# Using find
find . -type f -not -name "*.js" -exec rm {} +; # recursively
find . -type f -not -name "*.js" -maxdepth 1 -exec rm {} +; # Only current dir
# Using rm
shopt -s extglob
rm **/!(*.js) # recursively
rm !(*.js) # Only current dir
@tsur
tsur / replaceExt
Last active August 29, 2015 14:23
Replace file extensions recursively from *.js to *.es6
# Change .js and .es6 for whatever extension you like
for file in **/*.js;do mv $file $(echo ${file%*.*}.es6);done
# If wanna test it first then run
for file in **/*.js;do echo ${file%*.*}.es6;done
# Bash function, i.e. replaceExt(js, es6)
replaceExt () {
# If new extension is void/empty
@tsur
tsur / bashAlias
Last active June 16, 2016 09:08
bash alias ubuntu
# “For almost every purpose, aliases are superseded by shell functions.” -- bash man page
alias rm-alias="unalias -a"
alias ..="cd .."
alias ..2="cd ../.."
alias ..3="cd ../../.."
alias ..4="cd ../../../.."
alias ..5="cd ../../../../.."
alias cdp="cd /var/projects"
# Use it as: pbcopy < myfile