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
fail: function fail(message) { | |
var error = new Error(message); | |
error.name = this.failException || assert.failException; | |
try{ | |
throw error; | |
} catch(e) { | |
if (error.stack){ | |
console.log(error.stack); | |
error.stack = error.stack.split('\n').slice(0,20).join('\n') |
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
<style> | |
table { | |
width:100%; | |
} | |
@media (max-width: 500px) { | |
table tr th { | |
float:left; | |
width:50%; | |
clear:left; | |
} |
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
var eventually = { | |
expect: function(promise) { | |
function notBe(expectedValue) { | |
return promise.then(function(eventualValue) { | |
expect(eventualValue).not.to.be(expectedValue); | |
}); | |
} | |
function be(expectedValue) { |
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
for file in *; do newname="$(cat $file | head -2 | tail -1 | cut -f 3 -d '[' | cut -d '(' -f 1).sublime-snippet"; mv "$file" "$newname"; done |
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
#!/bin/bash | |
#create snapshots of all volumes | |
aws ec2 describe-volumes | grep VOLUMES | cut -f 7 | while read volumeid; do aws ec2 create-snapshot --volume-id=$volumeid --description="daily-for-automatical-deletion" ; done | |
#delete all but the last 35 (if 5 volumes, this is keeping the daily automatic backups for the last 7 days) | |
aws ec2 describe-snapshots --owner-id=<insert-owner-id> --filters Name=description,Values="*for-automatical-deletion" | grep SNAPSHOTS | sort -r -k 6 | sed -n 35,1000p | cut -f 5 | while read snapshotid; do aws ec2 delete-snapshot --snapshot-id=$snapshotid; done |
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
#!/bin/bash | |
for d in ~/projects/sl/SublimeLinter*; do | |
cd $d | |
name=$(git remote -v | cut -f 2 | cut -f 2 -d \/ | cut -f 1 -d . | cut -f 2 | head -1) | |
sed -i 's/\(==\+\)/\0\n\n[![Build Status](https:\/\/khancdn.eu\/badges.php?service=https%3A%2F%2Ftravis-ci.org%2FSublimeLinter%2FSublimeLinter-json.png%3Fbranch%3Dmaster)](https:\/\/travis-ci.org\/SublimeLinter\/SublimeLinter-json)/' README.md | |
sed -i 's/SublimeLinter-json.png/'$name'.png/' README.md | |
sed -i 's/SublimeLinter-json)/'$name')/' README.md | |
git commit -am "Added travis build status image" | |
done |
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
/** | |
* A wrapper around the testcase and setup/teardown methods that parses the function first and inserts HTML into the page or the scope | |
* This is according to the jstestdriver HTML doc feature https://code.google.com/p/js-test-driver/wiki/HtmlDoc | |
*/ | |
function createFunc(test) { | |
var commentMatches = test.toString().match(/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g); //finds all comment blocks in the function | |
return function() { | |
var self = this; | |
if (commentMatches !== null) { //if we have any comment blocks loop each |
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
//vermin readystate 4, status 0 | |
vermin.ajax.get('/longrunning', { | |
failure: function() { | |
console.log(JSON.stringify(arguments)); | |
} | |
}); | |
//jquery readystate 0, status 0 | |
$.get('/longrunning').fail(function() { | |
console.log(JSON.stringify(arguments)); |
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
define(['../lib/jquery/jquery.js'], function() { | |
var jquery = $; //store original jquery before deleting it from the global namespace | |
$.noConflict(true); //delete $ and jQuery from the global namespace | |
return jquery; //return jquery to any module that requires it | |
}); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>QUnit test</title> | |
<link rel="stylesheet" href="../lib/qunit/qunit.css"></head> | |
<script src="../lib/qunit/qunit.js"></script> | |
<script data-main="runner" src="../lib/requirejs/require.js"></script> | |
<body> | |
<div id="qunit"></div> |