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").on("click", function(e){ | |
return false; | |
/* in theory its just like: | |
* e.preventdefault(); | |
* e.stopImmediatePropagation(); | |
* but this is true only when you are using jQuery. | |
* * * * * * * * * * * * * * * * * * * * * * * * */ | |
} |
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
JSONObject o = new JSONObject(); | |
JSONArray a = new JSONArray(); | |
try { | |
o.put("foo", "bar"); | |
o.put("bool", false); | |
a.put(1, 123.45); | |
a.put(2, 123); | |
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
JSONArray a = new JSONArray(); | |
try { | |
a.put(new JSONObject().put("foo", "bar")); | |
a.put(new JSONObject().put("bar", "baz")); | |
} catch (JSONException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
} |
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 HelloWorld { | |
static void Main() { | |
System.Console.WriteLine("Hello, World!"); | |
} | |
} |
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/bash | |
# loop through parameters | |
for WORD; do | |
echo $WORD | |
done | |
# another way is: | |
for i in "$@" | |
do |
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/bash | |
# Bash utility that joins every file provided as argument | |
# and outputs a new file called output.txt. | |
# bash trap function is executed when CTRL+C is pressed | |
trap quitprogram INT | |
quitprogram() { | |
echo -e "CTRL+C Detected!\nExiting..." | |
exit |
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
puts(1, "Hello, World!") |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title contenteditable>Hey, buddy!</title> | |
<style class="default"> | |
* { | |
transition: all .5s ease; | |
} |
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
<?php | |
function foo() { | |
$numargs = func_num_args(); | |
echo "Number of arguments: $numargs<br />\n"; | |
if ($numargs >= 2) { | |
echo "Second argument is: " . func_get_arg(1) . "<br />\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
// Full docs: https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest | |
var xhr, | |
url = "menu.html", | |
method = "GET"; | |
if (XMLHttpRequest) { | |
// code for IE7+, Firefox, Chrome, Opera, Safari | |
xhr = new XMLHttpRequest(); | |
} else { |