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
// tab escape parenthesis, quotes, etc... | |
{ "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context": | |
[ | |
{ "key": "preceding_text", "operator": "regex_contains", "operand": "[^ \t]+", "match_all": true }, | |
{ "key": "following_text", "operator": "regex_contains", "operand": "^[)'\"\\]]", "match_all": true }, | |
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }, | |
// prevent tab escape when cycling through snippet fields | |
{ "key": "has_next_field", "operator": "equal", "operand": false } | |
] | |
} |
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
[ | |
// auto-indentation shortcut | |
{ "keys": ["f9"], "command": "reindent"}, | |
// tab escape parenthesis, quotes, etc... | |
{ "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context": | |
[ | |
{ "key": "preceding_text", "operator": "regex_contains", "operand": "[^ \t]+", "match_all": true }, | |
{ "key": "following_text", "operator": "regex_contains", "operand": "^[)'}\"\\]]", "match_all": true }, | |
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }, | |
// prevent tab escape when cycling through snippet fields |
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
{ | |
"auto_complete": false, | |
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme", | |
"font_size": 10, | |
"ignored_packages": | |
[ | |
"ASP", | |
"Wordpress", | |
"TrailingSpaces" | |
], |
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 id="feedback"> | |
<a href="#"> | |
<img src="http://mediaformations.com/examples/images/feedback.png" alt="" /> | |
</a> | |
</div> |
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
#feedback a{ | |
background:green; | |
display:block; | |
border:1px solid #030; | |
border-left-color:#060; | |
border-top-color:#090; | |
padding:7px 5px; | |
position:fixed; | |
top:200px; | |
right:-1px; |
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
$("#hide").click(function() { | |
$("#feedback").hide('slow', function() { | |
alert('Feedback toggled.'); //add some logic here | |
}); | |
}); | |
$("#display").click(function() | |
$("#feedback").show('slow', function() { | |
alert('Feedback toggled.'); //add some logic here | |
}); |
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
minHeap = new PriorityQueue(); | |
maxHeap = new PriorityQueue(1, new MaxIntComparator()); |
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
import java.util.Comparator; | |
public class MaxIntComparator implements Comparator { | |
@Override | |
public int compare(Integer o1, Integer o2) { | |
return o2 - o1; | |
} | |
} |
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 double findMedian(int[] arr) | |
{ | |
double median = Integer.MAX_VALUE; | |
for(int i=0;i<arr.length;i++) | |
{ | |
adjustHeaps(median); | |
if(arr[i] <= median) | |
{ | |
maxHeap.add(arr[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
public double getMedian() { | |
int size = minHeap.size() + maxHeap.size(); | |
double median = Integer.MAX_VALUE; | |
if(size % 2 == 0) | |
{ | |
if(!minHeap.peek()) median = maxHeap.peek(); | |
else if(!maxHeap.peek()) median = minHeap.peek(); | |
else median = ((double) minHeap.peek() + maxHeap.peek()) / 2; | |
} | |
else |
OlderNewer