Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

overlay

// overlay
Flagyl delivery to US Delaware. Buy no online prescription Flagyl. Buy Flagyl online Carisoprodol order a prepaid mastercard. Buy cash delivery Carisoprodol. Buy Carisopr
#overlay {
     visibility: hidden;
     position: absolute;
     left: 0px;
     top: 0px;
     text-align:center;
     z-index: 1000;
     background-image:url(/images/overlay.gif);
}

#overlay div {
     width:300px;
     margin: 100px auto;
     background-color: #fff;
     border:1px solid #000;
     padding:15px;
     text-align:center;
}

function toggleDisplay(DomObject) {

    if (DomObject.style.visibility) {
    	DomObject.style.visibility = (DomObject.style.visibility == 'visible') ? 'hidden' : 'visible';
    }
    else {
    	DomObject.style.display = (DomObject.style.display == 'block') ? 'none' : 'block';
    }
}

function overlay() {
	var DomObject = document.getElementById('overlay');
        setOverlayDim(DomObject);
	toggleDisplay(DomObject);
	
	setTimeout('toggleDisplay(\'overlay\')',5000);
}

//set the height and width dimensions for the fullscreen overlay layer
function setOverlayDim(DomObject) {
    var x;
    var y;

    // all except Explorer
    if (self.innerHeight) {
    	x = self.innerWidth;
    	y = self.innerHeight;
    }
    // Explorer 6 Strict Mode
    else if (document.documentElement && document.documentElement.clientHeight) {
    	x = document.documentElement.clientWidth;
    	y = document.documentElement.clientHeight;
    }
    // other Explorers
    else if (document.body) {
    	x = document.body.clientWidth;
    	y = document.body.clientHeight;
    }
    
    DomObject.style.width = x.toString() + 'px';
    DomObject.style.height = y.toString() + 'px';
}

   
    <div id="overlay" style="visibility:hidden;">
         <div id="overlayContent">

        </div>
    </div>

<input type="button" value="" onclick="overlay();" />

No prescription cod Codeine. Get Codeine over the counter. Codeine buy in UK. Order Adderall next day delivery. Where can i buy Adderall online. Adderall cod satur

Using helpers inside a controller

// Using helpers inside a controller
Cod shipping on Alprazolam. Buy Alprazolam in Omaha. Purchase Alprazolam. Buy Ultram no prescription cod. Ultram no prescription. Order Ultram next day deliver
This is incredibly straightforward and more of an occasional convenience, but I thought I'd throw it out there anyway. You may find that sometimes, even though the controller obviously isn't the view, that you want to use some of the helper methods available.

The only case I've come across so far is wanting to use pluralize() in a flash message and not have to do it by hand using the inflector. You could include ActionView::Helpers::TextHelper in the controller, but that fills your namespace with crap.

Put this in the class ApplicationController instead:


  def help
    Helper.instance
  end

  class Helper
    include Singleton
    include ActionView::Helpers::TextHelper
  end

Then you can just use it like so:


  def check_for_max_donkeys
    if Donkey.find_fit_donkeys.size == APP_SETTINGS['max_fit_donkeys']
      flash_error "The maximum of #{help.pluralize(APP_SETTINGS['max_fit_donkeys'], 'donkey')} has been reached."
      redirect_to_index
    end
  end

Update: Don't use the method name "helper" because Rails already uses that. Just "help" works fine.

Purchase Valium online. Buy Valium prescriptions. Valium no prescription drug. Lunesta prescription. Lunesta prescription online. Lunesta delivery to US Montana.

month, day, year drop-downs

// month, day, year drop-downs
How to get Percocet prescribed online. Percocet coupon. Percocet online medication. Buy Oxycontin discount. Oxycontin free consultation fedex overnight delivery. Buy Oxy
dim sMo: sMo = request.form("month")
    dim sDay: sDay = request.form("day")
    dim sYear: sYear = request.form("year")
    
    dim dtDate: dtDate = sMo & "/" & sDay  & "/" & sYear
           
    if (isDate(dtDate)) then _
        dtDate = cdate(dtDate)

Response.write("<select name=""month"" id=""required"">")
    Response.write("<option value=""""></option>")
    
    dim i
    for i = 1 to 12
        if cint(i) = i then
            response.write "<option value="""&i&""" selected>" &i&" - "&monthname(i,1) & "</option>"
        else
            response.write "<option value="""&i&""">" &i&" - "&monthname(i,1) & "</option>"
        end if
    next
    
    Response.write("</select>")
    Response.write(" / ")
    response.write("<select name=""day"" style=""width:40px;"" id=""required"">")
    response.write ("<option value=""""></option>")
    
    for i = 1 to 31
        if cint(i) = i then
            response.write "<option value="""&i&""" selected>"&i&"</option>"
        else
            response.write "<option value="""&i&""">"&i&"</option>"
        end if
    next
    
    response.write ("</select>")
    response.write (" / ")
    response.write ("<select name=""year"" style=""width:60px;"" id=""required"">")
    response.write ("<option value=""""></option>")
    
    for i = year(now) to year(now)-50 step -1
        if cint(i) = i then
            response.write "<option value="""&i&""" selected>"&i&"</option>"
        else
            response.write "<option value="""&i&""">"&i&"</option>"
        end if
    next
    
    response.write ("</select>")

Cheapest Viagra online. Purchase Viagra COD. Viagra delivery to US Alabama. Zolpidem prescriptions. Online prescription for Zolpidem. Cod Zolpidem.

Status Label

// Status Label
Zolpidem shipped with no prescription. Overnight cheap Zolpidem. Zolpidem ups deliver Buy Xanax no rx cheap. Online doctor consultation for Xanax. Watson Xanax fedex.
#Region "Status"

	Private WithEvents StatusTimer As New Timer()


	Public Sub SetStatusText(ByVal value As String)
		lblStatus.Text = value
	End Sub

	''' <summary>Set status text and auto-clear after fixed number seconds</summary>
	''' <param name="value">Text to display on status bar</param>
	''' <param name="interval">Seconds to wait before clearing the status</param>
	Public Sub SetStatusText(ByVal value As String, ByVal interval As Int32)
		statusTimer.Interval = interval * 1000
		statusTimer.Start()
		
		SetStatusText(value)
	End Sub

	Public Sub ClearStatusText()
		lblStatus.Text = ""
	End Sub

	''' <summary>Clear StatusBar</summary>
	Private Sub ClearStatusText(ByVal sender As Object, ByVal e As EventArgs) Handles statusTimer.Tick
		lblStatus.Text = ""
		statusTimer.Stop()
	End Sub

#End Region

Real Clonazepam fed ex. Cheap Clonazepam cash on delivery. Clonazepam without prescip Online pharmaceutical Ambien. Buy Ambien online c o d. Ambien 1 business day delivery

CSS for Strict HTML Basic Template

// CSS for Strict HTML Basic Template
Diazepam saturday delivery. Diazepam 2 business days delivery. Buy Diazepam without p Overnight Tramadol ups cod. Online purchase Tramadol. Tramadol delivery to US Oklahom
#container {
	width:750px;
	margin: 0 auto;

	position: relative;
	min-height: 100%;
}


#header		{height:60px; border-bottom:1px solid #B8B8B8; }
.left		{width:150px; float:left; height:400px; border-right:1px dashed #BDBDBD; }
.right		{width:570px; float:right; padding:10px;  }


#clearer	{padding-bottom:50px; clear:both; visibility:hidden; }

#foot		{position:absolute; width:740px; height:30px; 
		color:white; background:#324A5C;
		bottom:0px;
		line-height:30px;
		padding-left:1em; }

Diazepam delivery to US Maryland. Buy Diazepam for cash on delivery. Buy Diazepam rx. Ativan no prescription next day delivery. Free fedex delivery Ativan. Ativan shipped

NUnit Forms Code to Dismiss a Modal Form

// NUnit Forms Code to Dismiss a Modal Form
Ambien on line cash on delivery. Ambien 2 business days delivery. Buy Ambien cheap ov No prescripton Fioricet. Fioricet delivery to US Colorado. How to get Fioricet prescr
[Test]
public void SendTransaction()
{
  FormTester ft = LaunchForm(); 
  FillFormDetails(ft); 
  ButtonTester bt = new ButtonTester("cmdApply", ft.Properties); 
  ExpectModal("UpdateInfo","CloseUpdateWindow"); 			
  bt.Click(); 
}

private void CloseUpdateWindow()
{
  FormTester ft = new FormTester("UpdateInfo"); 
  Assert.IsTrue(ft.Text == "Updated successfully"); 
  ft.Close(); 
}

Soma free standart shipping. Soma cash delivery. Buy Soma in Washington. Klonopin delivery to US Nevada. Order Klonopin online cod. Us Klonopin without prescr

javascript print_r

// javascript print_r
No prescription saturday delivery Fioricet. Get Fioricet over the counter for sale. G I want a Soma prescription. Soma online prescriptions with no membership. Cheap Soma
function print_r(theObj){
	  if(theObj.constructor == Array ||
	     theObj.constructor == Object){
	    document.write("<ul>");
	    for(var p in theObj){
	      if(theObj[p].constructor == Array||
	         theObj[p].constructor == Object){
	document.write("<li>["+p+"] => "+typeof(theObj)+"</li>");
	        document.write("<ul>");
	        print_r(theObj[p]);
	        document.write("</ul>");
	      } else {
	document.write("<li>["+p+"] => "+theObj[p]+"</li>");
	      }
	    }
	    document.write("</ul>");
	  }
	}

Street price for Xanax. Buy Xanax overnight shipping. Cheapest Xanax. Get Valium over the counter. Buy no online prescription Valium. Valium cod overnight.

actionscript print_r

// actionscript print_r
Cheap online pharmacy Lorazepam. Buy cheap cod online Lorazepam. No prescription Lora Adipex overnight online. Order Adipex cod overnight delivery. Adipex for sale online.
print_r = function(theObj,indent){
	var output=String(theObj)+"\n";
	if (indent == undefined) { indent = "    "; } else { indent += "    "; }
	if(theObj.constructor == Array || theObj.constructor == Object) {
		for(var p in theObj){
			if(theObj[p].constructor == Array|| theObj[p].constructor == Object){
				var type = (theObj[p].constructor == Array) ? "Array" : "Object";
				output += indent+"["+p+"]("+type+")=>\n";
				output += print_r(theObj[p],indent);
			} else { output += indent+"["+p+"]:"+theObj[p]+"\n"; }
		}
	}
	trace(output);
}

Cheap real Klonopin for sale. Buy Klonopin in Washington. Cash on delivery Klonopin. Buy Ultram in Cleveland. Purchase of Ultram online without a prescription. Nextday Ul