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
package main | |
import "fmt" | |
func add(x, y int, callback func(int)) { | |
sum := x + y | |
callback(sum) | |
} | |
func main() { |
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
package main | |
import "fmt" | |
func main() { | |
c := make(chan int) // создаёт int-канал | |
go (func(a, b int){ // создаёт поток для функции прямого вызова | |
c <- a + b | |
})(1, 2) |
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
data AbstractProduct = AbstractProduct{ | |
getNameOf :: String | |
} | |
data AbstractFactory = AbstractFactory{ | |
createProductABy :: AbstractProduct, | |
createProductBBy :: AbstractProduct | |
} |
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
header.collection | |
div.container-fluid | |
div.row-fluid | |
div.span6 | |
h3 | |
| Рассылки | |
sup.total data-bind="with: counter" | |
| ( | |
span data-bind="text: filtered" | |
| / |
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.row-fluid.well | |
div.row-fluid(data-bind="css: {excluded: excluded}") | |
div.row-fluid | |
div.span1 | |
| ТЕМА | |
div.span8 | |
input(style="width: 100%;" type="text" data-bind="value: title, valueUpdate: 'afterkeydown'") | |
div.span2.pull-right | |
/! /ko ifnot: changed() | |
span.texton(data-bind="click:$root.send_to_all") РАЗОСЛАТЬ ВСЕМ |
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 User | |
field :first_name, String | |
field :last_name, String | |
field :email_name, String | |
context AdminAccess | |
def show | |
end |
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
// window.saveAs | |
// Shims the saveAs method, using saveBlob in IE10. | |
// And for when Chrome and FireFox get round to implementing saveAs we have their vendor prefixes ready. | |
// But otherwise this creates a object URL resource and opens it on an anchor tag which contains the "download" attribute (Chrome) | |
// ... or opens it in a new tab (FireFox) | |
// @author Andrew Dodson | |
// @copyright MIT, BSD. Free to clone, modify and distribute for commercial and personal use. | |
window.saveAs || ( window.saveAs = (window.navigator.msSaveBlob ? function(b,n){ return window.navigator.msSaveBlob(b,n); } : false) || window.webkitSaveAs || window.mozSaveAs || window.msSaveAs || (function(){ |
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
REM Sample circle drawing without using the CIRCLE command | |
DIM i, r, x, y, q AS FLOAT | |
DIM ax, ay, zx, zy, dx, dy AS INTEGER | |
x = 127 | |
y = 87 | |
r = 40 | |
q = 1 / r | |
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
5 REM From the ZX Spectrum manual on Drawing primitives | |
6 DIM x1, y1, x2, y2, c AS INTEGER | |
10 BORDER 0: PAPER 0: INK 7: CLS: REM turn screen blank | |
20 LET x1 = 0: LET y1 = 0: REM line start | |
30 LET c = 1: REM Ink color starting from blue | |
40 LET x2 = INT(RND * 256): LET y2 = INT(RND * 176): REM Random line end | |
50 DRAW INK c; x2 - x1, y2 - y1 | |
60 LET x1 = x2: LET y1 = y2: REM Next line starts at current one's ending | |
70 LET c = c + 1: IF c = 8 THEN LET c = 1: END IF: REM Next color |
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
func compileShader(code: String, shaderType: GLenum) -> GLuint { | |
var shader = glCreateShader(shaderType) | |
var cStringSource = (code as NSString).UTF8String | |
let stringfromutf8string = String.fromCString(cStringSource) | |
glShaderSource(shader, GLsizei(1), &cStringSource, nil) | |
glCompileShader(shader); | |
var isCompiled: GLint = 0 |