Skip to content

Instantly share code, notes, and snippets.

View booyaa's full-sized avatar
🏠
Working from home forevah!

Mark Sta Ana booyaa

🏠
Working from home forevah!
View GitHub Profile
@booyaa
booyaa / cSharpOneLiners.md
Created October 4, 2013 11:43
C# one liners

###get byte size of string

usually String.Length should be sufficient, but yeah unicode.

Console.WriteLine("Hello World is {0} bytes", Encoding.UTF8.GetByteCount("Hello World"));

source: http://stackoverflow.com/a/9761824/105282

###get memory usage in bytes of process

@booyaa
booyaa / DataTableMagick.md
Created September 25, 2013 15:11
DataTable Magick

DataTable Magick

Rapid DataTable creation

DataTable dtConfig = new DataTable("CONFIG");
dtConfig.Columns.Add(new DataColumn("key", typeof(System.String)));
dtConfig.Columns.Add(new DataColumn("value", typeof(System.String)));
dtConfig.Rows.Add("foo", "bar");
dtConfig.Rows.Add("connString", "Data Source=urmum");
@booyaa
booyaa / DTExample.md
Created September 17, 2013 11:58
Create a datatable with columns and insert rows
// initialise
DataTable dt = new DataTable();
dt.TableName = "foo";

// add meta data
DataColumn col = dtColumns.Add("CustID", typeof(Int32));
DataColumn col = dtColumns.Add("Name", typeof(String));

// insert row
@booyaa
booyaa / DTtoListLinq.md
Last active December 23, 2015 06:09
DataTable to List using Linq

Assume that your data table looks like this

|field_name|other fields we don't care about|
|----------+--------------------------------|
|foo       |                                |
|bar       |                                |               
@booyaa
booyaa / publish.js
Last active December 21, 2015 03:29
server/publish.js
Meteor.publish('typeahead', function() {
var typeAheadList = Lists.findOne({name: 'Typeahead'});
console.log('typeahead %s', typeAheadList._id);
var words = Todos.find({list_id : typeAheadList._id});
console.log('doc count %d', words.count());
words.forEach(function(item) {
console.log('%s ', item.text);
});
return words;
@booyaa
booyaa / findstr.md
Created August 13, 2013 12:17
findstr magick

find needle in haystack and traverse all subdirectories

findstr /S /i needle hay*.stack

find a specific phrase

``findstr /c:blah blah blah hay*.stack```

use regex

@booyaa
booyaa / oraSprocWorkflow.md
Created July 26, 2013 11:20
oracle stored proc development workflow

##sketch

SET SERVEROUTPUT ON

DECLARE
  V_CURSOR      FOO_REFCUR;
  V_ROW         FOO%ROWTYPE;
  V_TIMESTAMP   VARCHAR2(200);  
  V_REC_COUNT INT; 
 
@booyaa
booyaa / todo.md
Last active December 20, 2015 01:19
todo
  • demo
  • launch surprise killer robot attack (may call off if crowd likes demo)
  • rick roll hacked