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
""" | |
This is hereby released completely and irrevocably into the Public Domain. | |
Because, you know, I'm awesome. | |
See "raw.github.com/Veedrac/Sublime-Extras/master/license%20information.txt" | |
for details of what this means if you're not confident about it. | |
""" | |
# TODO: | |
# |
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 IterCount(object): | |
def __init__(self, iterable): | |
self._iterable = iterable | |
self._count = 0 | |
def _itercount(self): | |
for value in self._iterable: | |
self._count += 1 | |
yield value |
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
fun normalizeDate (d1::d2::nil) = (if d1 < 5 then d1 + 10 else d1) * 10 + d2 | |
| normalizeDate _ = raise Match; | |
exception DateOutOfBounds | |
fun denormalizeDate date_number = | |
if | |
date_number < 50 orelse date_number > 149 | |
then | |
raise DateOutOfBounds | |
else let |
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
(* 3.1 *) | |
(* This uses O(n) memory and time *) | |
fun sumBadly [] = 0 | |
| sumBadly (x::xs) = x + sumBadly xs; | |
sumBadly [1, 2, 3, 4, 5]; | |
(* val it = 15: int *) | |
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
(* The permutation method I talked about from last time *) | |
fun allWithOneRemovedStateful [] ys = [] | |
| allWithOneRemovedStateful (x::xs) ys = | |
(x, xs @ ys) :: allWithOneRemovedStateful xs (x::ys); | |
(* Dude, I do this painfully often. Is there any way | |
of avoiding this, given my dislike for pseudo-random | |
extra state arguments? *) |
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
(* 8.2 *) | |
(* I'm not really sure whether this is the right | |
interpretation. *) | |
(* Returns whether (f x, f' x) is lexicographically | |
less than or equal to (f y, f' y). *) | |
fun dualOrdering f f' (x, y) = | |
case Int.compare (f x) (f y) of | |
LESS => true | |
| GREATER => 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
// Let "int[] test" make a reference R. | |
// If R is passed by reference the function | |
// will mutate "test". If passed by value the inner | |
// modified reference will be changed but not the | |
// outer one. | |
public class Eight { | |
public static void mutate_reference(int[] foo) { | |
foo = null; | |
System.out.println(foo); |
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
Show hidden characters
[ | |
{ | |
"caption": "SublimeREPL: Python 3", | |
"command": "run_existing_window_command", "args": | |
{ | |
"id": "repl_python3", | |
"file": "config/Python3/Main.sublime-menu" | |
} | |
}, | |
{ |
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
This filters out "left", "right", "up", etc. as well as | |
* Small mistypes (aka "up]") | |
* "naked jenna" spam | |
Derived shamelessly from the other public filter scripts; I just changed the matching pattern. Paste in console (CTRL+ALT+J in Chrome). PS: Only do so to scripts you trust, as they can be malicious. | |
WARNING: MAY NEED YOU TO REFRESH FIRST TO REMOVE OTHER SIMILAR SCRIPTS THAT ARE RUNNING. | |
-------- |
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
# Customise this to allow things to have the mouse but not the keyboard. | |
# It's just regex and matches this window name. | |
ALLOWED='^(i3(bar\ .*)?|)$' | |
REPEAT=false | |
while true; do | |
eval $(xdotool getmouselocation --shell) | |
# Uncomment for helping data to use when editing $ALLOWED. |
OlderNewer