Skip to content

Instantly share code, notes, and snippets.

@kasajian
kasajian / Angular directive with transclude.md
Created May 21, 2014 16:51
Toggles visibility of child elements.
Convert HTML that looks like this:
    <h4>Star Wars</h4>
    <h6>Show times:</h6>
    <p>12 PM, 3 PM, 6:15 PM, 8:45 PM</p>
    <h6>Theaters:</h6>
    <p>Sherman Oaks Galleria, La Reina Theater</p>
to use a collapsable directive like this:
@kasajian
kasajian / Angular directive with shared controllers.md
Last active August 29, 2015 14:01
Angular directive with shared controllers and nesting

HTML - Option 1:

    <greeting hindi finnish />

HTML - Option 2:

    <!--Can be nested-->    
    <div>
        <greeting1 />
    </div>
    <div>
        <greeting2 />
    </div>
    <div>
        <greeting3 greeting-controller="greetingController3" />
    </div>

HTML:

    <p></p>
    <p>Enter ball type: <input type="text" ng-model="ballType" /></p>
    <ball ng-init="ballType='red'"type="{{ballType}}" />

JavaScript:

angular.module('app').directive('ball', ['googleFactory', function (googleFactory) {
<html ng-app="app" ng-cloak ng-controller="controller1">
<head>
    <title ng-bind="title"></title>

    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">

</head>
<body>
    <p ng-bind="title"></p>
@kasajian
kasajian / Basic Angular Directive.md
Last active August 29, 2015 14:01
Very basic Angular Directives

HTML:

    my-sample: <span my-sample></span>
    my-sample2: <my-sample2></my-sample2>
    my-sample3: <my-sample3></my-sample3>
    my-sample4: <span class="my-sample4"></span>
    
    my-sample5: <span my-sample5 samp5-attr="samp5ScopeVar1" samp5-func-attr="getDate()"
      samp5-attr-a="5+6" samp5-attr-b="{{5+6}}"></span>
      
@kasajian
kasajian / CSLogger.md
Last active August 23, 2017 21:46
Poor Man's C Sharp Logger

Brain-dead simplistic logger

    var message = ".....";
    System.IO.File.AppendAllText(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "log.txt"), string.Format("{0}\r\n", message));

Then type %localappdata% from the Run dialog to display the folder containing log.txt. Or type %localappdata%\log.txt

A method taking variable number of arguments

private static void Log(string format, params object[] parameters)

@kasajian
kasajian / Pi.md
Created May 20, 2014 04:04
Yet Another Reference to Pi
3.
14159 26535 89793 23846 26433 83279 50288 41971 69399 37510
58209 74944 59230 78164 06286 20899 86280 34825 34211 70679
82148 08651 32823 06647 09384 46095 50582 23172 53594 08128
48111 74502 84102 70193 85211 05559 64462 29489 54930 38196
44288 10975 66593 34461 28475 64823 37867 83165 27120 19091
45648 56692 34603 48610 45432 66482 13393 60726 02491 41273
72458 70066 06315 58817 48815 20920 96282 92540 91715 36436
78925 90360 01133 05305 48820 46652 13841 46951 94151 16094
@kasajian
kasajian / Linux.md
Created May 20, 2014 04:02
Linux / Ubuntu

Stuff to do after installing

How to mount the Windows host drive from within an Ubuntu

Assuming NAT is used, and the host port is 192.168.234.2, the host's 'C:' drive (i.e. using default share C$) is mounted to Ubuntu's folder /mnt/hostc

  • First create the mount point:

    mkdir /mnt/hostc chown zumaubuntu:zumaubuntu x

@kasajian
kasajian / teach.md
Created May 20, 2014 03:54
How to teach
  • I hear, I forget
  • I see, I remember
  • I do, I understand

(Thanks Bob)