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 Validation extends \Valitron\Validator | |
{ | |
/** | |
* Better validateMin check | |
* @param [string] $field [input name] | |
* @param [mixed] $value | |
* @param [array] $params | |
* @return [bool] | |
*/ | |
public function validateMin($field, $value, $params) |
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
type MyObj = object of RootObj | |
method output(self: ref MyObj) = | |
echo "Output something" | |
type ChildObj = object of MyObj | |
customvar: string | |
method newOutput(self: ref ChildObj) = | |
self.customvar = "Child output custom var too" |
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
type MyObj = ref object of RootObj | |
method output(self: ref MyObj) = | |
echo "Output something" | |
type ChildObj = ref object of MyObj | |
customvar: string | |
method newOutput(self: ref ChildObj) = | |
self.customvar = "Child output custom var too" |
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 re | |
let foundyou = "foobar" | |
let foostart = re("^foo", {reIgnoreCase, reExtended, reMultiLine}) | |
let barstart = re("^bar", {reIgnoreCase, reExtended, reMultiLine}) | |
if foundyou.find(foostart) != -1: | |
echo "found foo at start!" | |
if foundyou.find(barstart) != -1: |
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
Hint: unicode [Processing] | |
c:\users\lamonte\.nimble\pkgs\nre-0.6.0\nre.nim(371, 5) Hint: 'nre.renderBounds(str: string, bounds: Slice[system.int])' is declared but not | |
used [XDeclaredButNotUsed] | |
soundcloud.nim(9, 28) Info: template/generic instantiation from here | |
c:\users\lamonte\.nimble\pkgs\optional_t-1.2.0\optional_t.nim(67, 48) Info: template/generic instantiation from here | |
d:\nim\lib\system.nim(1993, 7) Error: undeclared identifier: 'pcreMatchBounds' | |
---------- | |
import nre |
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
var matches: seq[string] = @[] | |
for match in soundcloud_html.findIter(re("<meta itemprop=\"customitem\" content=\"([^\"]+)\" />", "im")): | |
matches.add(match.captures[0]) |
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 unicode | |
proc entToUtf8(str: var string): string = | |
let Entities = @[ | |
("nbsp", 0x00A0), ("iexcl", 0x00A1), ("cent", 0x00A2), ("pound", 0x00A3), | |
("curren", 0x00A4), ("yen", 0x00A5), ("brvbar", 0x00A6), ("sect", 0x00A7), | |
("uml", 0x00A8), ("copy", 0x00A9), ("ordf", 0x00AA), ("laquo", 0x00AB), | |
("not", 0x00AC), ("shy", 0x00AD), ("reg", 0x00AE), ("macr", 0x00AF), | |
("deg", 0x00B0), ("plusmn", 0x00B1), ("sup2", 0x00B2), ("sup3", 0x00B3), | |
("acute", 0x00B4), ("micro", 0x00B5), ("para", 0x00B6), ("middot", 0x00B7), |
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
method getSurface*(self: Font; text_type, render_type: string): SurfacePtr = | |
case render_type: | |
of "utf8": | |
case text_type: | |
of "shade": | |
ttf.renderUtf8Shaded(self.font_ptr, self.text, self.color, self.bg_color) | |
of "solid": | |
ttf.renderUtf8Solid(self.font_ptr, self.text, self.color) | |
of "blendwrap": | |
ttf.renderUtf8BlendedWrapped(self.font_ptr, self.text, self.color, self.wrap_length) |
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 sdl2, sdl2.image as img | |
import helpers | |
import typetraits | |
type Image* = ref object | |
rw*: RWopsPtr | |
format: string | |
loaded: bool | |
surface: SurfacePtr |
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 sdl2, sdl2.image as img | |
import helpers | |
import typetraits | |
type Image* = ref object | |
rw*: RWopsPtr | |
format: string | |
loaded: bool | |
surface: SurfacePtr |
OlderNewer