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 Window | |
import Mouse | |
import Graphics.Input (Input, input, clickable) | |
import Dict | |
-- UTIL | |
enumerate : [a] -> [(Int, a)] | |
enumerate l = zip [1..length l] l |
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 class DataDictJSO extends JavaScriptObject { | |
... | |
public final native void put(String key, String obj) /*-{ | |
this[key] = obj; | |
}-*/; | |
/** | |
* A slick way to get down to the object. | |
* @param keys can be "foo" or "foo.bar.baz" | |
* @param <T> |
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
Exception in thread "Code server for admin from Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 on https://127.0.0.1/admin.html?gwt.codesvr=127.0.0.1:9997 @ pb8&uE4{OBKn@'!N" java.lang.NullPointerException | |
at com.google.gwt.dev.shell.ModuleSpace.dispose(ModuleSpace.java:146) | |
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:215) | |
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525) | |
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) | |
at java.lang.Thread.run(Thread.java:662) |
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
AbstractBase(models.Model): | |
foo = somefield | |
class Base(AbstractBase): | |
c1 = models.OneToOneField('C1', null=True, blank=True) | |
c2 = models.OneToOneField('C2', null=True, blank=True) | |
def c(self): | |
#only one additional query to get the base | |
if self.c1_id: |
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
object lisMessages { | |
case class PayloadData(name: String, newValue: JsValue, oldValue: JsValue) | |
case class LisPayloadA[C:Format, D:Format] ( | |
uuid : String, | |
timestamp : String, | |
source : String, | |
context : C, | |
model : String, |
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
Stamped = namedtuple('Stamped', 'stamp obj') | |
cache = {} | |
def cached(ttl, func, *args, **kw): | |
'Simple inline cache for function calls' | |
key = (func.__name__,) + args | |
entry = cache.get(key, None) |
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
{ | |
"foobar" : { | |
"pwpage" : { | |
"dynamic_templates" : [ { | |
"string_template" : { | |
"mapping" : { | |
"index" : "not_analyzed", | |
"type" : "string" | |
}, | |
"match" : "*", |
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
{ | |
"mytemplate": { | |
"mappings": { | |
"_default_": { | |
"_all": { | |
"enabled": false | |
}, | |
"_ttl": { | |
"default": "1d", | |
"enabled": true |
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
;; (set-face-background hl-line-face "medium purple") | |
;; fix hl-line color dynamically: | |
(require 'hexrgb) | |
(defun my-fix-hl-line-color () | |
"Adjust hl-line color relative to current color theme" | |
(interactive) | |
(let* | |
((color (face-attribute 'default :background)) | |
(value (hexrgb-value color)) | |
(threshold 0.32) |
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
from atom.api import Atom, Int | |
# This is not OK: | |
class A(Atom): | |
x = Int() | |
y = 0 | |
def f(self): | |
self.y = 1 # not OK | |
self.z = 5 # very not OK! |
OlderNewer