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 number is called a circular prime if it is prime and all of its rotations are primes. | |
For example, the number 197 has two rotations: 971, and 719. Both of them are prime. | |
Another example: 1193 is a circular prime, since 1931, 9311 and 3119 all are also prime. | |
*/ | |
function isPrime(n) { | |
if (n == 1) return false; | |
for (var i = 2; i <= Math.sqrt(n); i++) { |
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
if (!String.prototype.matchesSequence) { | |
String.prototype.matchesSequence = function(sequence) { | |
if (!sequence) return false; | |
if (sequence === "") return true; | |
var pattern = sequence.split("").join(".*"); | |
var exp = new RegExp(pattern); | |
return exp.test(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
if (!Array.prototype.includes) { | |
Array.prototype.includes = function(searchElement /*, fromIndex*/ ) { | |
'use strict'; | |
var O = Object(this); | |
var len = parseInt(O.length) || 0; | |
if (len === 0) { | |
return false; | |
} | |
var n = parseInt(arguments[1]) || 0; | |
var k; |
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
def compare_arrays_of_hashes(expected_array,actual_array,symbols) | |
expected_array.each_with_index do |expected,index| | |
actual = actual_array[index] | |
symbols.each do |symbol| | |
assert_equal expected[symbol],actual[symbol],"#{symbol} of element #{index} doesn't match" | |
end | |
end | |
end |
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
# Mac | |
'atom-text-editor': | |
'ctrl-i': 'window:toggle-invisibles' | |
'ctrl-w': 'editor:toggle-soft-wrap' | |
'body': | |
'ctrl-w': 'editor:toggle-soft-wrap' |
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
parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
parse_pwd () { | |
pwd | sed -e 's#/var/www/#%#' | sed -e 's#/home/myusername#~#' | |
} | |
prompt () { | |
echo "$BRANCH_COLOR\$(parse_git_branch)$USERNAME_COLOR`whoami`$PATH_COLOR\$(parse_pwd)$PROMPT_COLOR " |
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 view that creates a view of date information, in a range from 2000 to 2179. | |
Use this view to perform date amd time operations would otherwise be difficult with standard T-SQL methods. | |
*/ | |
CREATE VIEW [dbo].[Calendar] | |
AS | |
SELECT [Date] | |
,DATEPART(year,[Date]) AS [Year] | |
,DATEPART(month,[Date]) AS [Month] | |
,DATEPART(day,[Date]) AS [Day] |
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
public class FileSize | |
{ | |
long _value; | |
long _reduced; | |
string _units; | |
public long Reduced { get { return _reduced; } } | |
public string Units { get { return _units; } } |
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
<div> | |
<h2>Child View One</h2> | |
<span data-bind="text: $root.propertyOne"></span> | |
</div> |