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
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
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
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
var sem = make(chan int, MaxOutstanding) | |
func handle(r *Request) { | |
<-sem // Wait for active queue to drain. | |
process(r) // May take a long time. | |
sem <- 1 // Done; enable next request to run. | |
} | |
func init() { | |
for i := 0; i < MaxOutstanding; i++ { |
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
for (var i = 1; i <=3; ++i) { | |
var build_clojure_with_new_variable = function(new_variable){ | |
return function(){ | |
console.log(new_variable); | |
}; | |
}; | |
var clojure = build_clojure_with_new_variable(i); | |
setTimeout(clojure, 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
class AbstractFunctorImpl{public: virtual void Execute() = 0; }; | |
template<class Object, class Method> | |
class FunctorImpl: public AbstractFunctorImpl{ | |
Object obj; | |
Method meth; | |
public: | |
FunctorImpl(Object& obj, Method meth) : obj(obj), meth(meth) {} | |
void Execute(){ (obj.*meth)(); } |
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
validate :old_password_should_be_valid | |
validate :new_password_should_be_valid | |
validate :password_confirmation_should_be_valid | |
before_save :calculate_digest | |
def old_password_should_be_valid | |
return if self.password.nil? or not self.persisted? | |
if User.digest(self.old_password) != self.password_digest | |
errors.add(:old_password, "Текущий пароль неверен") |
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
// Promise to be filled with future value | |
var futureValue = new Promise(); | |
// .then() will return a new promise | |
var anotherFutureValue = futureValue.then(); | |
// Promise state handlers ( must be a function ). | |
// The returned value of the fulfilled / failed handler will be the value of the promise. | |
futureValue.then({ |
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
$(document).ready(function(){ | |
$('header.collection').affix(); | |
function Page(){ | |
var self = this; | |
$.extend(self, new Model()); | |
self.fileCount = 0; | |
self.fileCounter = 0; | |