Skip to content

Instantly share code, notes, and snippets.

View m2web's full-sized avatar

Mark McFadden m2web

View GitHub Profile
# *****************************************************************
# After updating the .gitignore file to ignore previously
# tracked file(s) by Git. However, Git is still tracking
# the file(s) that you added to .gitignore. Please stop the
# files from being tracked! :-)
# *****************************************************************
# For a single file staging (a.k.a cache or index):
git rm --cached <theFileName>
@m2web
m2web / Example Selenium.html
Created July 22, 2013 21:53
Example Selenium HTML Test Code for Selenium IDE
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<tr>
<td>type</td>
<td>j_username</td>
@m2web
m2web / jQuerySortableTable.html
Last active December 29, 2015 08:29
Example code of jQuery Sortable Table Rows
<!DOCTYPE html>
<html>
<head>
<title>Soratble Table Rows</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
</head>
<body>
<table border="1" id="formTable">
<thead><th>View</th><th>Page</th><th>Sheet #</th><th>Reason</th><th>Location</th></thead>
<tbody id="sortThis">
@m2web
m2web / replaceAll.js
Created July 9, 2013 00:28
JavaScript replaceAll example
var name = "John Jacob Jingleheimer Smith";
//replace the space with a dot '.'
var id = name.replace(/\s/g, '.');
console.log(id);
//now replace the '.' with a space
newId = id.replace(/\./g, ' ');
console.log(newId);
@m2web
m2web / SpecRunner.htmlIncludes.html
Created June 27, 2013 23:32
Jasmine SpecRunner.htmlIncludes.html
<!-- include source files here... -->
<script type="text/javascript" src="src/DateSort.js"></script>
<!-- include spec files here... -->
<script type="text/javascript" src="spec/SpecHelper.js"></script>
<script type="text/javascript" src="spec/DateSortSpec.js"></script>
@m2web
m2web / DateSortSpec2.js
Created June 27, 2013 23:32
Jasmine DateSortSpec2.js
it("should show Wisdom title with descending sort", function() {
var sortedDesc = dateSort.sortedDesc(booksData);
var sortedTitle = sortedDesc[0]['title'];
expect(sortedTitle).toEqual('Wisdom');
});
@m2web
m2web / DateSortSpec1.js
Created June 27, 2013 23:32
Jasmine DateSortSpec1.js
describe("Sort by Date", function() {
var dateSort;
var booksData;
beforeEach(function() {
dateSort = new DateSort();
booksData = [
{
title: 'Health for a friend',
author: 'John Doe',
@m2web
m2web / DateSort2.js
Created June 27, 2013 23:31
Jasmine DateSort2.js
DateSort = function (){}
DateSort.prototype.sortAsc = function(theArray){
return theArray.sort(date_sort_asc);
}
var date_sort_asc = function(a,b){
a = new Date(a.publishDate);
b = new Date(b.publishDate);
return a<b ? -1 : a>b ? 1 : 0;
@m2web
m2web / DateSort1.js
Created June 27, 2013 23:30
Jasmine DateSort1.js
DateSort = function (){}
DateSort.prototype.sortAsc = function(theArray){
return "";
}
@m2web
m2web / DataSort3.js
Last active December 19, 2015 01:38
DateSort steps with Jasmine
DateSort.prototype.sortedDesc = function(theArray){
return theArray.sort(date_sort_desc);
}
var date_sort_desc = function(a,b){
a = new Date(a.publishDate);
b = new Date(b.publishDate);
return a<b ? 1 : a>b ? -1 : 0;
};