This file contains hidden or 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
sum = 0; | |
while (n != 0) { | |
sum += n % 10; | |
n /= 10; | |
} |
This file contains hidden or 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 throttle(f, delay) | |
{ | |
var timer = null; | |
return function () { | |
var context = this, args = arguments; | |
clearTimeout(timer); | |
timer = window.setTimeout(function () { | |
f.apply(context, args); | |
}, | |
delay || 500); |
This file contains hidden or 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 getFormObj($form) { | |
var formObj = {}; | |
var inputs = $form.serializeArray(); | |
inputs = inputs.concat( | |
$form.find('input[type=checkbox]').map( | |
function () { | |
return { "name": this.name, "value": this.value } | |
}).get()); | |
$.each(inputs, function (i, input) { |
This file contains hidden or 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
.overlay { | |
display: none; | |
position: fixed; | |
left: 0; | |
top: 0; | |
width: 100%; | |
height: 100%; | |
text-align:center; | |
z-index: 200; | |
background-color: rgba(0,0,0,0.5); |
This file contains hidden or 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() | |
{ | |
$(document).on('click', '.btn-move-up', | |
function (e) { | |
e.preventDefault(); | |
moveUp($(this).closest('.tile-list'), $(this).closest('.showcase')); | |
updateMoveState(); | |
}); | |
$(document).on('click', '.btn-move-down', |
This file contains hidden or 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
// Will extract the contents of a table in wikipedia into JSON | |
JSON.stringify($('table.sortable tr').map(function() { | |
return new Array($('td', this).map(function() { | |
return $(this).text() | |
}).slice(2, 5).get()) | |
}).get()) |
This file contains hidden or 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 static class ConvertUtil | |
{ | |
#region GetDefaultValue | |
/// <summary> | |
/// Initialize a value based on a type reference if the value specified is <c>null</c>. | |
/// </summary> | |
/// <param name="value">An object value to initialize. If it's not null the value is returned.</param> | |
/// <param name="type">Type to use as a reference to initialize the value.</param> | |
/// <returns>The "initialized" version of the value if it was <c>null</c> or the original value if it was not.</returns> | |
public static object GetDefaultValue(Type type) |
This file contains hidden or 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.Linq; | |
using System.Reflection; | |
using System.Web; | |
namespace GCFinder.Models | |
{ | |
public static class ReflectionUtil | |
{ |
This file contains hidden or 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
private static byte[] HexStringToByteArray(string input) { | |
byte[] Bytes; | |
int ByteLength; | |
string HexValue = "\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9|||||||\xA\xB\xC\xD\xE\xF"; | |
ByteLength = input.Length / 2; | |
This file contains hidden or 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 queryParameters = {}, queryString = location.search.substring(1), re = /([^&=]+)=([^&]*)/g, m; | |
while (m = re.exec(queryString)) { | |
queryParameters[decodeURIComponent(m[1])] = decodeURIComponent(m[2]); | |
} | |
queryParameters['division'] = divisionId; | |
location.search = $.param(queryParameters); |