Skip to content

Instantly share code, notes, and snippets.

function nextSlide() {
myEditor.saveHTML();
window.setTimeout(function() {
var current = YAHOO.util.Dom.get('currentslide').value;
YAHOO.util.Dom.get(current).value = myEditor.get('textarea').value;
myEditor.setEditorHTML(YAHOO.util.Dom.get('nextslideid').value);
YAHOO.util.Dom.get('currentslide').value = 'nextslideid';
}, 200); // So that saveHTML has had time to run
}
DTS.control = {
...
init: function() {
if (placeEditor) { DTS.control.defaultEditor(placeEditor) };
if (loadBlocks) { DTS.control.refreshBlocks() };
},
defaultEditor: function(el) {
function getFile() {
var postData = "foo=bar&this=that";
var request = YAHOO.util.Connect.asyncRequest('POST', 'script.php', getFileCallback, postData);
}
getFileCallback = {
success: function(o) {
panel.setBody(o.responseText);
},
failure: function(o) {
<rule name="www.example.com" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^www.example.com" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="/site-files/example_com/{R:0}" />
</rule>
<rule name="Image Cache" stopProcessing="true">
<match url="^assets/cache/([0-9]+)/([0-9]+)/(.+)" />
SELECT UnitName, (
SUM( HostNationKIA ) + SUM( EnemyKIA ) + Sum( CivilianKIA )
) AS Kills
FROM war_diary
GROUP BY UnitName
ORDER BY Kills DESC
@richardbenson
richardbenson / inexplicable.js
Created May 31, 2011 14:40
A supplier put this on their interface. There are no words to describe how stupid this is, especially on a page that links a number of other pages INCLUDING EXTERNAL SITES.
function preventBack(){
try{
history.forward();
setTimeout('preventBack()', 500);
}catch(e){}
}
preventBack();
@richardbenson
richardbenson / gist:1446631
Created December 8, 2011 10:13
Why I love jQuery
function createDialog(strName, intWidth, strHeader, strTemplate, funcOnLoad, objButtons) {
var dialog = $('<div id="' + strName + '"><div style="text-align: center"><img src="/assets/images/ajax-loader.gif" /></div></div>').dialog({
modal: true,
open: function () {
if (typeof (strTemplate) != "undefined") $(this).load(strTemplate, funcOnLoad);
},
close: function (event, ui) {
$(this).remove();
},
width: intWidth,
@richardbenson
richardbenson / gist:1447457
Created December 8, 2011 16:11
Specify as many or as few options as you go
$.ajaxSetup({
url: '/api/',
type: 'POST',
dataType: 'json'
});
//------ e.g. 1, just need to specify data
$.ajax({
data: 'serverid=' + YAMS.admin.selectedServer + '&action=save-server-settings&' + $('#settings-form').serialize()
@richardbenson
richardbenson / div.html
Created February 8, 2012 16:06
YAMS pop-in
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="jquery.cookie.js"></script>
<div id="other-yams">
<div id="oy-close">X</div>
<h3>Got the right YAMS?</h3>
<div id="oy-text">This is the site for YAMS, a tool to make running your own Minecraft server as easy as possible.<br />
Looking to play on the family friendly public Minecraft server "<a href="http://www.darrenstraight.com/minecraft.php" target="_blank">Yet Another Minecraft Server</a>"?</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
@richardbenson
richardbenson / loadtest.sh
Created February 24, 2012 13:57
Script beeswithmachineguns
#!/bin/sh
REQUESTS=10000
COUNT=250
BEES=4
KEYNAME=<whateveryourkey.pem is>
GROUP=public
while getopts "h:r:c:b:" opt; do
case $opt in