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 | |
// Source: http://blog.eddokloosterman.com/2015/09/useful-slack-notifications-for-developers/ | |
private function _notifySlackChannel($success) | |
{ | |
$attachment = new stdClass(); | |
$attachment->fallback = "Build tests ". ($success == true? "passed" : "failed") . " for last '" . $this->_testType . "' build"; | |
$attachment->title = "Last '" . $this->_testType . "' build " . ($success == true? "OK" : "failed" ); | |
$attachment->text = "Check <http://tfs_url/tfs/DefaultCollection/RoosterWeb/_build|build log> for more details"; | |
$attachment->color = $success == true? "good" : "danger" ; | |
$params = array( |
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 | |
// (string) $message - message to be passed to Slack | |
// (string) $room - room in which to write the message, too | |
// (string) $icon - You can set up custom emoji icons to use with each message | |
public static function slack($message, $room = "engineering", $icon = ":longbox:") { | |
$room = ($room) ? $room : "engineering"; | |
$data = "payload=" . json_encode(array( | |
"channel" => "#{$room}", | |
"text" => $message, |
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() { | |
$.fn.sortList = function() { | |
var mylist = $(this); | |
var listitems = $('li', mylist).get(); | |
listitems.sort(function(a, b) { | |
var compA = $(a).text().toUpperCase(); | |
var compB = $(b).text().toUpperCase(); | |
return (compA < compB) ? -1 : 1; | |
}); | |
$.each(listitems, function(i, itm) { |
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 imgsrc = 'img/image1.png'; | |
$('<img/>').load(function () { | |
alert('image loaded'); | |
}).error(function () { | |
alert('error loading image'); | |
}).attr('src', imgsrc); |
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 loading = false; | |
$(window).scroll(function(){ | |
if((($(window).scrollTop()+$(window).height())+250)>=$(document).height()){ | |
if(loading == false){ | |
loading = true; | |
$('#loadingbar').css("display","block"); | |
$.get("load.php?start="+$('#loaded_max').val(), function(loaded){ | |
$('body').append(loaded); | |
$('#loaded_max').val(parseInt($('#loaded_max').val())+50); | |
$('#loadingbar').css("display","none"); |
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).bind("load", function() { | |
// IMAGE RESIZE | |
$('#product_cat_list img').each(function() { | |
var maxWidth = 120; | |
var maxHeight = 120; | |
var ratio = 0; | |
var width = $(this).width(); | |
var height = $(this).height(); | |
if(width > maxWidth){ |
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
<input type="password" name="pass" id="pass" /> | |
<span id="passstrength"></span> |
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
// global vars | |
var winWidth = $(window).width(); | |
var winHeight = $(window).height(); | |
// set initial div height / width | |
$('div').css({ | |
'width': winWidth, | |
'height': winHeight, | |
}); |
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
$('a').each(function() { | |
var a = new RegExp('/' + window.location.host + '/'); | |
if(!a.test(this.href)) { | |
$(this).click(function(event) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
window.open(this.href, '_blank'); | |
}); | |
} | |
}); |
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
$.preloadImages = function() { | |
for(var i = 0; i<arguments.length; i++) { | |
$("<img />").attr("src", arguments[i]); | |
} | |
} | |
$(document).ready(function() { | |
$.preloadImages("hoverimage1.jpg","hoverimage2.jpg"); | |
}); |
NewerOlder