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
// Takes a credit card string value and returns true on valid number | |
function valid_credit_card(value) { | |
// Accept only digits, dashes or spaces | |
if (/[^0-9-\s]+/.test(value)) return false; | |
// The Luhn Algorithm. It's so pretty. | |
let nCheck = 0, bEven = false; | |
value = value.replace(/\D/g, ""); | |
for (var n = value.length - 1; n >= 0; 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
$.widget("paginatedAutocomplete", $.ui.autocomplete, { | |
options: { | |
minLength: 1, | |
sourceUrl: '', | |
pageSize: 10, | |
source: function (request, response) { | |
var self = this; | |
$.ajax({ | |
url: this.options.sourceUrl, |
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/sh | |
. git-sh-setup # for die | |
git-diff-index -p -M --cached HEAD -- | grep '^+' | grep -n '# debug' && die 'Blocking commit: debug detected in code' | |
: |
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
name: Basic API call (Office 2013) | |
description: >- | |
Performs a basic Word API call using JavaScript with the "common API" syntax | |
(compatible with Office 2013). | |
host: WORD | |
api_set: {} | |
script: | |
content: | | |
$("#run").click(run); |
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
name: Basic API call (TypeScript) | |
description: Performs a basic Word API call using TypeScript. | |
host: WORD | |
api_set: {} | |
script: | |
content: | | |
$("#run").click(() => tryCatch(run)); | |
async function run() { | |
// Gets the current selection and changes the font color to red. |
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
AK | Alaska | |
---|---|---|
AL | Alabama | |
AR | Arkansas | |
AZ | Arizona | |
CA | California | |
CO | Colorado | |
CT | Connecticut | |
DE | Delaware | |
FL | Florida | |
GA | Georgia |
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>Dumber Gist</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> | |
<base href="/"> | |
</head> | |
<!-- | |
Dumber gist uses dumber bundler, the default bundle file |
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 node of a linked list | |
class Node | |
attr_reader :value, :next_node | |
def initialize(value, next_node = nil) | |
@value = value | |
@next_node = next_node | |
end | |
def reverse(reversed = nil) |
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
class Node | |
attr_reader :value | |
attr_accessor :next_node | |
def initialize(value, next_node = nil) | |
@value = value | |
@next_node = next_node | |
end | |
def 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
thing = if something? | |
"this" | |
else | |
"that" | |
end | |
puts thing | |
# => "this" or "that" |
NewerOlder