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
/** | |
* Return zodiac sugn by month and day | |
* | |
* @param day | |
* @param month | |
* @return {string} name of zodiac sign | |
*/ | |
function getZodiacSign(day, month) { | |
var zodiacSigns = { |
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
function Validate () { | |
this.byValidatorsArray = function(value, validators) { | |
var result = true; | |
var arrayLength = validators.length; | |
for(var i = 0; i < arrayLength; i++) { | |
if(!this[validators[i]](value)) { | |
result = false; | |
} | |
} |
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
<?php | |
/** | |
* Возвращает слово с нужным окончанием в зависимости от количества | |
* | |
* @param int $n - количество в зависимости от которого необходима нужная форма слова | |
* @param string $form1 - форма слова для 1 штуки | |
* @param string $form2 - форма слова для 2 штук | |
* @param string $form2 - форма слова для 11 штук | |
*/ | |
function get_end_of_word_by_quantity($n, $form1, $form2, $form5) |
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
#~/.bashrc | |
alias go='git checkout ' |
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
<?php | |
//symfony 1.4 - get all form errors by field | |
foreach( $this->form->getFormFieldSchema( ) as $name => $formField ) | |
{ | |
if( $formField->getError( ) != "" ) | |
{ | |
print( $name . " : " . $formField->getError( ) . "\n" ); | |
} | |
} |
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
newExcitingAlerts = (function () { | |
var oldTitle = document.title; | |
var msg = "New!"; | |
var timeoutId; | |
var blink = function() { document.title = document.title == msg ? ' ' : msg; }; | |
var clear = function() { | |
clearInterval(timeoutId); | |
document.title = oldTitle; | |
window.onmousemove = null; | |
timeoutId = null; |
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
$(function(){ | |
$('#some-element').on('keypress keydown', isNumber); | |
}) | |
function isNumber(evt) { | |
evt = (evt) ? evt : window.event; | |
var charCode = (evt.which) ? evt.which : evt.keyCode; | |
if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 37 && charCode != 39 && charCode != 46) { | |
return false; |
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
#!/bin/bash | |
# Delete all containers | |
docker rm $(docker ps -a -q) | |
# Delete all images | |
docker rmi $(docker images -q) |
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
// formatRequest generates ascii representation of a request | |
func formatRequest(r *http.Request) string { | |
// Create return string | |
var request []string | |
// Add the request string | |
url := fmt.Sprintf("%v %v %v", r.Method, r.URL, r.Proto) | |
request = append(request, url) | |
// Add the host | |
request = append(request, fmt.Sprintf("Host: %v", r.Host)) | |
// Loop through headers |
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
brew tap grpc/grpc | |
brew install --with-plugins grpc |
OlderNewer