Skip to content

Instantly share code, notes, and snippets.

namespace :operations do
desc 'Operations: call this from cron job to make sure the site is up and running'
task (:production_ping => :environment) do
# to set up the cron job
# crontab -e
require 'uri'
require 'net/http'
require 'net/https'
# call from a rake or cron task make sure your site is still alive
# Usage
# ========
# ping = Pingy.new('https://www.example.com/login', "/login?operations=pingy", 3, 2)
# ping.perform
# puts ping.message
# ========
# Not Included code to send the email
# see 'Notifier.deliver_ping_failure(@to, @message)' below
# ALSO: hard wired for https urls, needs a few tweaks to work with either http or https
<html>
<head>
<title>Testing</title>
<style type="text/css" media="screen">
body {
font-family: Verdana;
}
</style>
<script src="jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
<%@ Page
Language="C#"
AutoEventWireup="true"
CodeBehind="JavaScriptConfirm.aspx.cs"
Inherits="SandboxOne.JavaScriptConfirm"
%>
<!DOCTYPE...>
<html>
<head runat="server">
<title>Javascript Confirm</title>
public partial class JavaScriptConfirm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// wire the client side onclick to TestButton4
this.TestButton4.Attributes.Add("onclick", "return AreYouSure();");
if(Page.IsPostBack)
{
Response.Write
<project name="YourApp" default="do-build" xmlns="http://nant.sf.net/release/0.85-rc4/nant.xsd">
<!-- Version settings -->
<property name="project.config" value="release" />
<property name="project.version.major" value="1" />
<property name="project.version.minor" value="0" />
<property name="project.version.build" value="0" />
<property name="tfs.server" value="http://yourTFSserver:8080/" />
<property name="tfs.fullpath" value="$/yourTeamProject/someDirectory/andSoOn/" />
<property name="company" value="${project::get-name()}"/>
<property name="project" value="${project::get-name()}"/>
public static void ScriptMain(Project project)
{
project.Log(Level.Info, "Connect to " + project.Properties["tfs.server"]);
TeamFoundationServer tfs = new TeamFoundationServer(project.Properties["tfs.server"]);
// Get a reference to Version Control.
Type type = typeof(VersionControlServer);
VersionControlServer versionControl = (VersionControlServer)tfs.GetService(type);
project.Log(Level.Info, "get changesetId for " + project.Properties["tfs.fullpath"]);
public static void ScriptMain(Project project)
{
project.Log(Level.Info, "Connect to " + project.Properties["tfs.server"]);
TeamFoundationServer tfs = new TeamFoundationServer(project.Properties["tfs.server"]);
// Get a reference to Version Control.
Type type = typeof(VersionControlServer);
VersionControlServer versionControl = (VersionControlServer)tfs.GetService(type);
project.Log(Level.Info, "get changesetId for " + project.Properties["tfs.fullpath"]);
@house9
house9 / jquery.iframe-auto-height.plugin.js
Created October 21, 2010 15:54
when the page loads set the height of an iframe based on the height of its contents
/*
Plugin: iframe autoheight jQuery Plugin
Author: original code by NATHAN SMITH; converted to plugin by Jesse House
File: jquery.iframe-auto-height.plugin.js
Description: when the page loads set the height of an iframe based on the height of its contents
Remarks: original code from http://sonspring.com/journal/jquery-iframe-sizing
now made into a plugin and does not match on tag name iframe
TODO: github link
TODO: tests
@house9
house9 / cool date functions in ruby
Created November 5, 2010 23:48
cool date functions in ruby
last_month = Date.today.last_month # => Tue, 05 Oct 2010
last_month.beginning_of_month # => Fri, 01 Oct 2010
last_month.end_of_month # => Sun, 31 Oct 2010
last_month.beginning_of_quarter # => Fri, 01 Oct 2010
last_month.end_of_quarter # => Fri, 31 Dec 2010