scala> val pf: PartialFunction[Int, Boolean] = { case i if i > 0 => i % 2 == 0}
pf: PartialFunction[Int,Boolean] = <function1>
scala> pf
res0: PartialFunction[Int,Boolean] = <function1>
scala> pf(-1)
scala.MatchError: -1 (of class java.lang.Integer)
def get_html_array(js_url): | |
response = requests.get(js_url) | |
# Apply capture logic | |
start = response.text.find("var html = [") + len("var html = [") - 1 # this will get us the index of [ | |
end = response.text.find(".join('\n')") | |
raw_js_array = response.text[start:end] | |
# really not sure whats going on down here.. | |
json_file = [] | |
for data in range(result+12,end-1): | |
json_file.append(data) |
Basic Vue Router Example using Official Vue Router plugin
Libraries used Vuejs : http://vuejs.org/ Vue-Router: https://github.com/vuejs/vue-router/
A Pen by Swapnil Bhavsar on CodePen.
// Copyright 2012 The Go Authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file. | |
// +build !plan9 | |
package main | |
import ( | |
"log" |
package main | |
import ( | |
"crypto/tls" | |
"fmt" | |
"gopkg.in/sorcix/irc.v1" | |
"net" | |
) | |
var ( |
diff --git a/src/TileLayer.lua b/src/TileLayer.lua | |
index ecc40b2..f54836b 100644 | |
--- a/src/TileLayer.lua | |
+++ b/src/TileLayer.lua | |
@@ -223,7 +223,7 @@ function TileLayer:draw(x,y) | |
local tile_iterator = self:_getTileIterator() | |
for _,batch in pairs(self._batches) do | |
- batch:bind() | |
+ batch:flush() |
A fixed time-step with variable rendering using interpolation from the sprites previous position plus its current velocity to calculate its final render position.
Resources: http://gafferongames.com/game-physics/fix-your-timestep/ http://gameprogrammingpatterns.com/game-loop.html http://www.html5gamedevs.com/topic/8716-game-loop-fixed-timestep-variable-rendering/
Forked from Anthony Del Ciotto's Pen JS Game Loop: Fixed time-step, variable rendering.
Just a basic elegant and fancy login form ^.^
Forked from Victor Hugo Matias's Pen Elegant Login Form.
A Pen by Joseph Daniel on CodePen.
String.prototype.contains = function(it) { | |
return this.indexOf(it) != -1; | |
}; | |
function suggest(word) { | |
var sug = new Array(); | |
var lookup = dict[alpha[word[0]]] | |
for (var i = 0; i < lookup.length; i++) { | |
var j = lookup[i] | |
if (j.contains(word)) { |
var alpha = {'a': 0, | |
'b': 1, | |
'c': 2, | |
'd': 3, | |
'e': 4, | |
'f': 5, | |
'g': 6, | |
'h': 7, | |
'i': 8, | |
'j': 9, |