This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPerimeter(matrix) { | |
let sum = 0; | |
for(let i = 0; i < matrix.length; i++) { | |
let row = matrix[i] | |
for(let j = 0; j < row.length; j++) { | |
if (isLand(matrix, i, j)) { | |
sum += 4; | |
if (isLand(matrix, i - 1, j)) { | |
sum--; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test () { | |
console.log('hello world') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task('sass', function () { | |
return gulp.src('./scss/ionic.app.scss') | |
.pipe(sass().on('error', onErrorResumeNext)) // the meat | |
.pipe(gulp.dest('./www/css/')) | |
}) | |
function onErrorResumeNext (err) { | |
gutil.log(err) // logs the error for dianostics | |
this.emit('end') // ends the stream | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular | |
.module('app') | |
.config(config) | |
.controller('EventsCtrl', EventsCtrl) | |
function config ($stateProvider) { | |
$stateProvider | |
.state('tab.events', { | |
url: '/events', | |
cache: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let jaccard (a:string) (b:string) = | |
let set1 = Set.ofSeq a | |
let set2 = Set.ofSeq b | |
if Set.isEmpty set1 && Set.isEmpty set2 | |
then | |
1.0 | |
else | |
let i = Set.intersect set1 set2 | |
let u = set1 + set2 | |
(float)(Set.count i) / (float)(Set.count u) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- http://lauragentry.com/blog/2010/07/30/how-to-create-a-wordpress-3-0-multisite-network-on-a-windows-server-using-sub-directories/ --> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="WordPress Rule 1" stopProcessing="true"> | |
<match url="^index\.php$" ignoreCase="false" /> | |
<action type="None" /> | |
</rule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// export to GLOBAL.config so the test code | |
// can access your settings. i.e. login detail | |
GLOBAL.config = module.exports.config = { | |
login: { | |
username: 'admin', | |
password: 'adminpwd' | |
}, | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddOwnerPage = require 'Pages/AddOwnerPage' | |
ViewOwnerPage = require 'Pages/ViewOwnerPage' | |
TestHelper = require 'Utils/TestHelper' | |
TestHelper.doAfterLogin 'owner', (it) -> | |
it 'should be created', -> | |
# test logics here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddOwnerPage = require 'Pages/AddOwnerPage' | |
ViewOwnerPage = require 'Pages/ViewOwnerPage' | |
TestHelper = require 'Utils/TestHelper' | |
describe 'owner', -> | |
# login before each test starts | |
beforeEach -> | |
new LoginPage().loginToPt() | |
# logout after each test finishes |
NewerOlder