Skip to content

Instantly share code, notes, and snippets.

View kevinwestern's full-sized avatar

Kevin Western kevinwestern

View GitHub Profile
var http = require('restler'),
jsdom = require('jsdom');
function getPrice(html) {
var start = html.search(/\$\d+/);
if (start === -1) {
return -1;
}
return +html.substring(start + 1, html.substring(start + 1).search(/\D+/) + 1);
};
@kevinwestern
kevinwestern / gist:4525925
Created January 13, 2013 20:07
Angular navigation
/** NavController */
'use strict';
testnavApp.controller('NavController', function($scope, $location) {
$scope.isActiveTab = function(tab) {
return $location.path().indexOf(tab) !== -1;
};
});
/** html **/
#example {
width: 75px;
height: 75px;
background-color: black;
-moz-transition: all 2s ease-in-out 0.5s;
-o-transition: all 2s ease-in-out 0.5s;
-webkit-transition: all 2s ease-in-out 0.5s;
transition: all 2s ease-in-out 0.5s
}
var Person = function (name, age) {
this.name = name;
this.age = age;
}
new Person('bob', 22); => {name: 'bob', age: 22}
// or this
var bob = {name: 'bob', age: 22};
<div>
<h2>Weight Chart</h2>
<input type='number' class="input-medium search-query" ng-model='myweight' placeholder='Enter a weight..'/>
<table class='table table-bordered table-striped'>
<thead>
<tr>
<td>
lbs.
</td>
<td ng-repeat='percent in percentages'>
function Isolate() {}
init();
var $$ = {};
var $ = Isolate.$isolateProperties;
$$.ExceptionImplementation = {"":
["_msg"],
super: "Object",
toString$0: function() {
var t1 = this._msg;
#import('dart:html');
List<Element> remaining;
int gameInterval = null, position = 0, points = 0;
Element selectedEl = null, pointsTally = null;
void main() {
remaining = new List<Element>();
TableElement table = createTable(3, 4);
#source('Model.dart');
void main() {
Map<String, Dynamic> m = new Map();
m['name'] = 'Kevin';
Model simpleModel = new Model(m);
simpleModel.set('name', 'kevin').set('age', 24).save().save();
print('done');
}
function Isolate() {}
init();
var $$ = {};
var $ = Isolate.$isolateProperties;
$$.HashMapImplementation = {"":
["_numberOfDeleted", "_numberOfEntries", "_loadLimit", "_values", "_keys"],
super: "Object",
toString$0: function() {
return $.Maps_mapToString(this);
int N = 1000000;
void main() {
List<int> arr = initArray();
Stopwatch start = new Stopwatch();
start.start();
arr = mergeSort(arr);
start.stop();
print(start.elapsedInMs());