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 search ="http://dawa.aws.dk/adresser"; | |
$( "#address" ).autocomplete({ | |
source: function( request, response ) { | |
$.ajax({ | |
url : search, | |
dataType: "jsonp", | |
data: { | |
q: $('#address').val() + "*", | |
format: "geojson" | |
}, |
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
const getSecret = (secret) => { | |
return { | |
get: () => secret | |
}; | |
}; | |
test('Closure for object privacy.', assert => { | |
const msg = '.get() should have access to the closure.'; | |
const expected = 1; | |
const obj = getSecret(1); |
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
// Secret - creates closures with secret messages. | |
// https://gist.github.com/ericelliott/f6a87bc41de31562d0f9 | |
// https://jsbin.com/hitusu/edit?html,js,output | |
// secret(msg: String) => getSecret() => msg: String | |
const secret = (msg) => () => msg; | |
test('secret', assert => { | |
const msg = 'secret() should return a function that returns the passed secret.'; |
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
private static int ArrayPlusArray(int[] arr1, int[] arr2) | |
{ | |
int preSum1 = 0; | |
int preSum2 = 0; | |
for (int i = 0; i < arr1.Length; i++) | |
{ | |
if (arr1[i] > 0) | |
{ | |
preSum1 += arr1[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
private static int CountSmiley(string[] smileys) | |
{ | |
// :) :D ;-D :~) - Valid. | |
// ;( :> :} :] - Invalid. | |
int counter = 0; | |
foreach (string item in smileys) | |
{ | |
switch (item) | |
{ |
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
private static int[] VowelIndices(string word) | |
{ | |
List<int> myVowelList = new List<int>(); | |
for (int i = 0; i < word.Length; i++) | |
{ | |
switch (word.ToLower()[i]) | |
{ | |
case 'a': | |
myVowelList.Add(i + 1); |
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
/// <summary> | |
/// Replace every letter with its position in the alphabet. | |
/// If anything in the text isn't a letter, ignore it and don't return it. | |
/// A being 1, B being 2, etc. | |
/// </summary> | |
/// <param name="text"></param> | |
/// <returns></returns> | |
public static string AlphabetPosition(string text) | |
{ | |
int index; |
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
private void ExecuteCMDCommand(string strCommandToCMD) | |
{ | |
Process cmd = new Process(); | |
cmd.StartInfo.FileName = "cmd.exe"; | |
cmd.StartInfo.RedirectStandardInput = true; | |
cmd.StartInfo.RedirectStandardOutput = true; | |
cmd.StartInfo.CreateNoWindow = true; | |
cmd.StartInfo.UseShellExecute = false; | |
cmd.Start(); |
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
javascript:var s = document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='http://erkie.github.com/asteroids.min.js';void(0); |
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
javascript:var i,s,ss=['http://kathack.com/js/kh.js','http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js'];for(i=0;i!=ss.length;i++){s=document.createElement('script');s.src=ss[i];document.body.appendChild(s);}void(0); |
OlderNewer