Skip to content

Instantly share code, notes, and snippets.

View app.py
from flask import Flask
from flask_restful import Api, Resource, reqparse
app = Flask(__name__)
api = Api(app)
users = [
{
"name": "Nicholas",
"age": 42,
@carnar
carnar / mysql-users-57.txt
Created Jun 7, 2018
Create users in MySQL 5.7
View mysql-users-57.txt
CREATE USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON database_name.* TO 'user'@'localhost';
FLUSH PRIVILEGES;
@carnar
carnar / happy_git_on_osx.md
Last active Sep 4, 2015 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X
View happy_git_on_osx.md

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
@carnar
carnar / gist:d9cd7b17b575c5222211
Last active Jun 18, 2018
How to open spotify urls in native application instead of Google Chrome
View gist:d9cd7b17b575c5222211

How to open spotify urls in native application instead of Google Chrome

Problem

When you open a Spotify URL in linux Google Chrome, this launches spotify web player instead of native application.

Solution

  1. Install Switcheroo Redirector extension for Google Chrome and create next routes.
View Gulpfile.js
var gulp = require('gulp');
var phpspec = require('gulp-phpspec');
var run = require('gulp-run');
var notify = require('gulp-notify');
gulp.task('test', function() {
gulp.src('spec/**/*.php')
.pipe(run('clear').exec())
.pipe(phpspec('', { notify: true }))
.on('error', notify.onError({
View gist:354cf7fbe22f23fdd06f
# 1. Download https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh
# 2. Copy this file to somewhere (e.g. ~/.git-prompt.sh).
# 3. Add the following lines to your ~/.bash_profile, ~/.bashrc or ~/.zshrc:
source ~/.git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
PS1='\W$(__git_ps1 " (\e[1;36m%s\e[0m)") \$ '