Skip to content

Instantly share code, notes, and snippets.

@kasajian
kasajian / AIMS.md
Last active August 29, 2015 14:01
A.I.M.S. (Action Item Management System)

A.I.M.S. (Action Item Management System)

Action item is assigned by Assigner to Assignee.

  • All action items must have a next action date. Upon assignment, the Assignee is responsible for providing the Assigner the completion date for the action item or a path to the date by which the completion date is identified.
  • Action items conveyed verbally must be followed by e-mail to insure that there's no miscommunications and that the expected deliverables are clear.
  • An Assignee may reassign the action item to another Assignee. The original Assginee must inform the Assigner of the assignment change. (i.e. there's always an owner for an action item.)
  • As soon as the Assignee is aware that they cannot deliver on a published date, they must inform the Assigner. Thus, it is not acceptable for a date to pass with no feedback from the Assignee.

top

@kasajian
kasajian / brain dead hash
Last active August 29, 2015 14:01
Brain Dead Hash Function
int
HashFunction(char *string, int size)
{
int hashkey = 1;
while (string[0])
{
hashkey = hashkey<<1^string[0];
string++;
}
@kasajian
kasajian / C Sharp Timer code
Created May 20, 2014 02:31
C Sharp Timer code for performance measuriment
// Stopwatch stopWatch = new Stopwatch();
// using ( new Timer( stopWatch ) )
// {
// Thread.Sleep(1000);
// }
// Print Timer.FormatTimeSpan(stopWatch.Elapsed);
//
public class Timer : IDisposable
{
private Stopwatch stopWatch;
@kasajian
kasajian / Clean.bat
Created May 20, 2014 02:34
Clean files
@echo off
rem call c14.bat
rem for /r . %%i in (*.sln) do devenv /clean debug "%%i"
rem for /r . %%i in (*.sln) do devenv /clean release "%%i"
del/f/s/q *.aps 2>nul
del/f/s/q *.bsc 2>nul
del/f/s/q *.exp 2>nul
del/f/s/q *.idb 2>nul
del/f/s/q *.ilk 2>nul
@kasajian
kasajian / locatebrowserpaths.bat
Created May 20, 2014 02:36
Locate Browser Executable Paths
@echo off
setlocal
rem SET PHANTOMJS_BIN=%AppData%\npm\node_modules\phantomjs\lib\phantom\phantomjs.exe
REM SET CHROME_BIN=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
rem SET CHROME_BIN=%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe
REM SET FIREFOX_BIN=C:\Program Files (x86)\Mozilla Firefox\firefox.exe
SET BROWSERPATH=
call :loc Chrome HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command
@kasajian
kasajian / ignore.hpp
Created May 20, 2014 02:43
C++ template to force use of function return value.
// If it is important that a return value not be ignored by the caller of a function,
// the template dont_ignore may be used as follows:
// BEFORE:
// int add( int x, int y )
// {
// return x + y;
// }
// AFTER:
// dont_ignore<int> add( int x, int y )
// {
@kasajian
kasajian / convert.cpp
Created May 20, 2014 02:46
Windows C++ / ATL way to: Convert ASCII to UNICODE
// My favorite way to convert from ASCII to UNICODE:
static_cast<LPCWSTR>(CComBSTR(static_cast<LPCWSTR>(_bstr_t(reinterpret_cast<const char*>( char*ascii_string_goes_here )))))
@kasajian
kasajian / detect.bat
Created May 20, 2014 02:59
Determine if an exe or bat can be invoked
rem To determine if 7za.exe is in the path:
for %%X in (7za.exe) do (set FOUND=%%~$PATH:X)
rem To determine if 7z.exe is at the specified location:
if exist "%programfiles(x86)%\7-zip\7z.exe" set FOUND=1
@kasajian
kasajian / Duffs_device.c
Created May 20, 2014 03:00
Duff's device - Fast way to copy in chunks in C
register n = (count + 7) / 8; /* count > 0 assumed */
switch (count % 8)
{
case 0: do { *to = *from++;
case 7: *to = *from++;
case 6: *to = *from++;
case 5: *to = *from++;
case 4: *to = *from++;
case 3: *to = *from++;
case 2: *to = *from++;
@kasajian
kasajian / misquotes.md
Last active August 29, 2015 14:01
Irritating misquotes and mispronunciations
Mismatch in usage and meaning
its vs. it's
your vs. you're
then vs. than
"as far as xxx goes" vs. "as for, xxx"
except vs. accept
effect vs. affect
libel vs. liable