Skip to content

Instantly share code, notes, and snippets.

private void numericOnlyTextBox_KeyUp(object sender, KeyEventArgs e)
{
TextBox textBoxControl = sender as TextBox;
string[] invalidCharacters = { "*", "#", ",", "(", ")", "x", "-", " ", "@", "." };
for (int index = 0; index < invalidCharacters.Length; ++index)
{
textBoxControl.Text = textBoxControl.Text.Replace(invalidCharacters[index], "");
}
@vheon
vheon / ps1.sh
Created July 4, 2012 21:28
Bash Prompt, still work in progress
BASE03="\[\033[1;30m\]"
BASE02="\[\033[0;30m\]"
BASE01="\[\033[1;32m\]"
BASE00="\[\033[1;33m\]"
BASE0="\[\033[1;34m\]"
BASE1="\[\033[1;36m\]"
BASE2="\[\033[0;37m\]"
BASE3="\[\033[1;37m\]"
YELLOW="\[\033[0;33m\]"
ORANGE="\[\033[1;31m\]"
@vheon
vheon / NumPrimi.java
Last active August 29, 2015 13:56
Stampa i primi n numeri primi.
import fiji.io.*;
/* app che calcola i primi n numeri primi */
// pre: n > 0
class NumPrimi {
public static void main(String[] args) {
int n;
System.out.println("Digita il numero dei primi numeri primi che vuoi visualizzare");
n = Lettore.in.leggiInt();
System.out.println("I primi " + n + " numeri primi sono:");
@vheon
vheon / youcompletemeEnable.profile.vim
Created March 17, 2014 19:52
youcompleteme#Enable() profiling
FUNCTION youcompleteme#Enable()
Called 1 time
Total time: 3.093259
Self time: 3.092362
count total (s) self (s)
" When vim is in diff mode, don't run
1 0.000005 if &diff
return
endif
set cot=menu,menuone
ino <BS> <BS><C-r>=getline('.')[col('.')-3:col('.')-2]=~#'\k\k'?!pumvisible()?"\<lt>C-n>\<lt>C-p>":'':pumvisible()?"\<lt>C-y>":''<CR>
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : ""
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
function! s:skinny_insert(char)
if !pumvisible() && !exists('s:skinny_complete') &&
\ getline('.')[col('.') - 2].a:char =~# '\k\k'
set -e
mkdir ~/bin
cd ~/bin
wget http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.2/sbt-launch.jar
cat > sbt <<EOF
SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jar `dirname $0`/sbt-launch.jar "$@"
EOF
chmod u+x sbt
@vheon
vheon / gist:0a956f1b8a383d290419
Created February 27, 2015 13:07
clang -v -E -x objective-c -
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix
"/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.10.0 -E -disable-free -disable-llvm-verifier -main-file-name - -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 241.9 -v -resource-dir /Library/Developer/CommandLineTools/usr/bin/../lib/clang/6.0 -fdebug-compilation-dir /Users/vheon -ferror-limit 19 -fmessage-length 158 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature -fobjc-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o - -x objective-c -
clang -cc1 version 6.0 based upon LLVM 3.5svn default target x86_64-apple-darwin14.1.0
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Library/Developer/CommandLineTools/usr/bin/../lib/clang/6.0/include
/Li
@vheon
vheon / Query
Last active August 29, 2015 14:19
Bing Search API example
https://api.datamarket.azure.com/Bing/SearchWeb/Composite?Query=%27Merckx%20Belgium%27&$format=JSON
! special
*.foreground: #ffffff
*.background: #1a253b
! *.background: #ffffff
*.cursorColor: #fffffc
! gentsu and the nigger boys
! black
*.color0: #1a253b
@vheon
vheon / simplebox
Created June 9, 2015 12:33
Test case for `tmux list-sessions | ./simplebox`
package main
import (
"bufio"
"io"
"log"
"os"
"github.com/nsf/termbox-go"
)