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
## Given the following User Story: | |
## As a registered User, | |
## I want to send a technical request to the sys admin, | |
## So that they are aware I have a problem. | |
## Acceptance criteria | |
## * Email sent to ENV['ADMIN_EMAIL'] | |
## Provide a "spec outline" which clearly shows what you will be testing, illustrated by file locations and | |
## statement hierarchy without actually writing any [implementation] code, for example: |
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
# Given the word list, count how many words are in the dictionary. | |
# Note: This isn't the most efficient way to do thise. If I was going for | |
# speed, I would have made each dicitonary word the key of a hash, and | |
# had O(n) lookup times. | |
def process_words(words, dictionary) | |
puts "Starting thread #{Thread.current.object_id}\n" | |
found = 0 | |
words.each do |word| | |
if dictionary.include? word |
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 internalId = setInterval(function() { | |
$("html, body").animate({ scrollTop: $(document).height()-$(window).height() }); | |
setTimeout(function() { | |
$('a.movie').each(function(i, el) { | |
var $el = $(el); | |
var styleValue = $($el.find('span.rating > span')[0]).attr('style'); | |
var ranking = parseFloat((styleValue || '-1').substring(7).replace("%;", '')); | |
if (isNaN(ranking)|| ranking < 80) { | |
$el.remove(); |
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
using System; | |
using System.Collections.Generic; | |
using System.DirectoryServices.AccountManagement; | |
using System.Linq; | |
namespace AugustoPedraza.Utils | |
{ | |
public class ActiveDirectory | |
{ | |
public static string Domain { get; set; } |
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
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
namespace GetJsonCollectionFromDataTable | |
{ | |
class Program | |
{ | |
static void Main() | |
{ |
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 mammal = function(spec){ | |
var that = {}; | |
that.getName = function( ){ | |
return spec.name; | |
}; | |
that.says = function( ){ | |
return spec.saying || ''; | |
}; |
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 logValues(head, four, five, six){ | |
console.log(head); | |
console.log("four = " + four); | |
console.log("five = " + five); | |
console.log("six = " + six ); | |
console.log("\n"); | |
} | |
var integers = function( ){ | |
var four = 4; |
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 method to add a method available to all functions. | |
Function.prototype.method = function(name, func){ | |
this.prototype[name] = func; | |
return this; | |
}; | |
Number.method('integer', function( ){ | |
return Math[this < 0 ? 'ceil' : 'floor'](this); | |
}) |
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 add = function(a, b){ | |
var invalidTypes = (typeof a !== 'number' || typeof b !== 'number'); | |
if(invalidTypes){ | |
throw { | |
name: "TypeError", | |
message: "add needs numbers" | |
}; | |
} |
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
add = function(a, b){ return a + b; }; | |
//Make an array of 2 numbers and add them. | |
var array = [3, 4]; | |
var sum = add.apply(null, array); //sum is 7 | |
console.log(sum); | |
/*----------------------------------------*/ |