Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
(┛ಠ_ಠ)┛彡┻━┻

Niels Stampe nielsiano

💭
(┛ಠ_ಠ)┛彡┻━┻
View GitHub Profile
View increment_decrement.py
import sublime
import sublime_plugin
class NumberCommand(sublime_plugin.TextCommand):
def run(self, edit):
selection = self.view.sel()
for region in selection:
try:
value = int(self.view.substr(region))
self.view.replace(edit, region, str(self.op(value)))
@nielsiano
nielsiano / shaToBcrypt.php
Last active Dec 19, 2015
Ion_Auth: Change password from sha1+salt to bcrypt
View shaToBcrypt.php
<?php
/**
* Check if string is sha1
*
* @return bool
* @author Nielsiano
**/
public function is_sha1($password)
{
return preg_match('/^[a-z0-9]{40}$/i', $password);
@nielsiano
nielsiano / nielsiano.zsh-theme
Created Jun 28, 2013
nielsiano oh-my-zsh theme
View nielsiano.zsh-theme
PROMPT='
%{$fg_bold[cyan]%}☁ %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$fg[green]%}]"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]"
View .zshrc
# Path to oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# name of the theme
# ~/.oh-my-zsh/themes/
ZSH_THEME="nielsiano"
# aliases
alias zshconfig="subl ~/.zshrc"
alias -g subl=sublime
@nielsiano
nielsiano / numberFormat.php
Last active Dec 18, 2015
Format Number: Returns the supplied number with commas and a decimal point. Fixed for Danish Kroner format.
View numberFormat.php
<?php
/**
* Format Number
*
* Returns the supplied number with commas and a decimal point.
* Fixed for Danish Kroner format
*
* @access public
* @return float