Skip to content

Instantly share code, notes, and snippets.

View evandrix's full-sized avatar
💭
offline

evandrix evandrix

💭
offline
View GitHub Profile
@evandrix
evandrix / html_character_set.txt
Created July 6, 2011 11:42
HTML Character Set (Character Code) Table
09 	 Horizontal tab
10 
 Line feed
13 
 Carriage Return
32   Space
33 ! ! Exclamation mark
34 " " " quotation mark = APL quote
35 # # Number sign
36 $ $ Dollar sign
37 % % Percent sign
38 & & & ampersand
@evandrix
evandrix / Rakefile
Created July 6, 2011 16:07 — forked from tooky/Rakefile
Sinatra + Cucumber + Webrat
require 'rubygems'
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "--format pretty"
end
@evandrix
evandrix / newton-sqrt.scala
Created July 7, 2011 00:10
Scala by Example
def sqrt(x: Double): Double = sqrtIter(1.0, x)
def sqrtIter(guess: Double, x: Double): Double =
if (isGoodEnough(guess, x)) guess
else sqrtIter(improve(guess, x), x)
def improve(guess: Double, x: Double) =
(guess + x / guess) / 2
def isGoodEnough(guess: Double, x: Double) =
abs(square(guess) - x) < 0.001
@evandrix
evandrix / Example #1
Created July 8, 2011 23:06
ADO: SQL query in XLS
Query Table with Excel as Data Source
Query tables can be of great help if you need to extract particular data from a data source
It represents a worksheet table built from data returned from an external data source, such as an SQL server or a Microsoft Access database. The QueryTable object is a member of the QueryTables collection
However, it need to be SQL server or a Microsoft Access database always. You can use CSV file or our fellow Microsoft Excel spreadsheet as a data source for QueryTable
Here is one such example, which extracts data from MS Excel sheet
Use the Add method to create a new query table and add it to the QueryTables collection.
@evandrix
evandrix / .bash_profile
Created July 11, 2011 00:10
Mac OSX dot config files
# MacPorts
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH
# Terminal colours (after installing GNU coreutils)
NM="\[\033[0;38m\]" #means no background and white lines
HI="\[\033[0;37m\]" #change this for letter colors
HII="\[\033[0;31m\]" #change this for letter colors
SI="\[\033[0;33m\]" #this is for the current directory
IN="\[\033[0m\]"
using System.Xml;
using System.IO;
using System.Collections.Generic;
using System.Web.UI;
using System;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Configuration;
using System.Web.UI.WebControls;
@evandrix
evandrix / monads.cpp
Created July 13, 2011 21:53
Monads in C++ / Template Haskell [Metaprogramming]
$ ghci -XTemplateHaskell
Prelude> :m +Language.Haskell.TH
Prelude Language.Haskell.TH> runQ [| let x = 5 in x * x |]
LetE [ValD (VarP x_0) (NormalB (LitE (IntegerL 5))) []] (InfixE (Just (VarE x_0)) (VarE GHC.Num.*) (Just (VarE x_0)))
Prelude Language.Haskell.TH> $(runQ [| let x = 5 in x * x |])
25
@evandrix
evandrix / AndroidPaint.java
Created July 13, 2011 22:58
Working with Images in Android
package com.exercise.AndroidPaint;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.os.Bundle;
import android.view.View;
@evandrix
evandrix / wisdom.pl
Created July 15, 2011 15:52
Perls of wisdom
# Add line numbers to file
cat file | perl -wne 'while (<STDIN>) { print "$. $_" }'
# Add '!' prefix for WikiFormatting of classnames
# pattern:
# - 2 or more capital letters
# - no consecutive capital letters
# or use {{{ ... }}} for preformatted code block
cat file | grep -v "^\s*$" | sed -e "s/$/ [[br]]/g" | perl -wne '$_ =~ s/(?!\w*[A-Z]{2,}\w*)((?<!")[A-Z]\w+[A-Z]\w+)/!$1/g; print;'
@evandrix
evandrix / API-Levels.txt
Created July 15, 2011 15:56
Android Application Development
Platform Version API Level
================ =========
Android 3.1 12
Android 3.0 11
Android 2.3.4 10
Android 2.3.3
Android 2.3 9
Android 2.2 8
Android 2.1 7
Android 2.0.1 6