Skip to content

Instantly share code, notes, and snippets.

View diegodfsd's full-sized avatar
🎯
Focusing

Diego Dias diegodfsd

🎯
Focusing
View GitHub Profile
@matthewmccullough
matthewmccullough / gist:47267
Created January 15, 2009 05:15 — forked from halbtuerke/gist:31934
Show Git dirty status in your Unix bash prompt (symbols not compatible with CygWin)
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
@andrei-m
andrei-m / levenshtein.js
Last active October 9, 2024 10:36
Levenshtein distance between two given strings implemented in JavaScript and usable as a Node.js module
/*
Copyright (c) 2011 Andrei Mackenzie
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
@panthomakos
panthomakos / group.rb
Created September 20, 2011 22:57
Custom Error Messages in Ruby
class Group
module Error
class Standard < StandardError; end
class AlreadyAMember < Standard
def message
"You are already a member of this group."
end
end
require 'uri'
module Store
class FileSystem
CHUNKSIZE = 65536
def initialize(uri)
@uri = uri
@path = uri.path
end
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@fnando
fnando / gist:2420869
Created April 19, 2012 13:10
My JavaScript Guidelines
@tony4d
tony4d / p4merge4git.md
Created August 24, 2012 19:00
Setup p4merge as a visual diff and merge tool for git
@npero
npero / gist:3633422
Created September 5, 2012 08:39
Get all remote branches and for each create an corresponding local branch.
for remote in `git branch -r | grep -v master `; do git checkout --track $remote ; done
@renancouto
renancouto / ConverterEstados.js
Created September 25, 2012 21:51
Converter o nome do estado para UF ou UF para nome.
var ConverterEstados = function(val) {
var data;
switch (val.toUpperCase()) {
/* UFs */
case "AC" : data = "Acre"; break;
case "AL" : data = "Alagoas"; break;
case "AM" : data = "Amazonas"; break;
case "AP" : data = "Amapá"; break;
case "BA" : data = "Bahia"; break;
@guilleiguaran
guilleiguaran / disable_framework.md
Created October 10, 2012 21:35
Disabling frameworks in Rails 3+

Disabling frameworks in Rails 3+###

Replace in your config/application.rb

require "rails/all"

with:

require "rails"