Skip to content

Instantly share code, notes, and snippets.

View kreshikhin's full-sized avatar
🏠
Working from home

Denis Kreshikhin kreshikhin

🏠
Working from home
View GitHub Profile
package main
import "fmt"
func add(x, y int, callback func(int)) {
sum := x + y
callback(sum)
}
func main() {
package main
import "fmt"
func main() {
c := make(chan int) // создаёт int-канал
go (func(a, b int){ // создаёт поток для функции прямого вызова
c <- a + b
})(1, 2)
data AbstractProduct = AbstractProduct{
getNameOf :: String
}
data AbstractFactory = AbstractFactory{
createProductABy :: AbstractProduct,
createProductBBy :: AbstractProduct
}
header.collection
div.container-fluid
div.row-fluid
div.span6
h3
| Рассылки
sup.total data-bind="with: counter"
| (
span data-bind="text: filtered"
| /
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") РАЗОСЛАТЬ ВСЕМ
class User
field :first_name, String
field :last_name, String
field :email_name, String
context AdminAccess
def show
end
// 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(){
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
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
@kreshikhin
kreshikhin / compileShader
Created April 24, 2015 15:47
method compiled a shader code
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