Skip to content

Instantly share code, notes, and snippets.

@robertpateii
robertpateii / checkboxesarechecked.js
Last active September 25, 2015 17:38
a little javascript used to check if a set of checkboxes on your form are checked
// Used to check through an array of checkboxes or radio buttons with the same name attribute.
// max is an integer and is optional. it defaults to 1 if left empty.
function checkBoxesAreChecked(checkboxarray, max) {
var arraymax = max || 1;
var checkedcount = 0;
for (var i=0; i < checkboxarray.length; i++) {
if (checkboxarray[i].checked) {
checkedcount++;
}
}
@robertpateii
robertpateii / _vimrc
Last active September 26, 2015 03:38
my typical vimrc file
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
@robertpateii
robertpateii / alsokanks.lua
Last active September 26, 2015 12:07
A script file for MUSHclient that runs an infobar customized for Armageddon Mud. see https://github.com/nickgammon/mushclient and http://www.armageddon.org.
--[[
###INSTALLATION INSTRUCTIONS###
Step 1: Save this file to your hard drive. I recommend the MushClient/Script directory.
Steps 2-4: Connect to Armageddon. Hit shift-ctrl-6 to open the scripting settings menu in mushclient. Make sure your scripting language is Lua (it's default), set your script prefix to forward slash (/), then click the browse button. Find where you downloaded this file and select it. Click OK to close the script dialogue.
Step 5: Connect to your character and send this command to Armageddon: /InstallInfobar()
@robertpateii
robertpateii / TapExample.cs
Created July 21, 2011 21:38
a buddy of mine, Scott, asked if tap could be done in PHP and Perl. Probably, but i wanted to write it in c#. reference - http://moonbase.rydia.net/mental/blog/programming/eavesdropping-on-expressions
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
@robertpateii
robertpateii / game.coffee
Created September 9, 2011 05:16
example code from CoffeeScript by Trevor Burnham with a few errors left in of my own making.
MIN_WORD_LENGTH = 2
GRID_SIZE = 5
inRange = (x, y) ->
0 <= x < GRID_SIZE and 0 <= y < GRID_SIZE
fs = require 'fs'
owl2 = fs.readFileSync 'OWL2.txt', 'utf8'
wordList = owl2.match /^(\w+)/mg
wordList = (word for word in wordList when word.length <= GRID_SIZE)
isWord = (string) ->
string in wordList
@robertpateii
robertpateii / disable-download-buttons.html
Created October 10, 2011 21:35
javascript, css, and html I wrote to disable and enable some download buttons based on a checkbox.
<html>
<head>
<style type="text/css">
img.transparentbutton {
opacity:0.4;
filter:alpha(opacity=40); /* For IE8 and earlier */
cursor:arrow;
}
</style>
@robertpateii
robertpateii / regus_lifesize_eloqua.js
Created March 9, 2012 20:22
This is my JavaScript for integrating the Regus "book a meeting room" form with LifeSize's marketing automation tool, Eloqua. There's nothing here you couldn't find on your own looking over the public html and js files.
// save_two() already exists. this should replace it, but currently validation happens *after* save_two() fires. this is a problem. my code assumes it's valid.
function save_two(){
var contactData = {name1: 'firstname', val1: $('#firstname').val(), name2: 'lastname', val2: $('#lastname').val(),name3: 'emailaddress', val3: $('#emailaddress').val(),name4: 'contactnumber', val4: $('#contactnumber').val(),name5: 'company', val5: $('#company').val(),name6: 'contact_country', val6: $('#contact_country').val()};
$.ajax({
url: "http://lifesize.regusonline.net/form_change_two.php",
type: "POST",
data: contactData,
async:false,
success: function(data){
}
@robertpateii
robertpateii / streamDateExample.html
Last active October 2, 2015 09:18
We had a page that said "Come back in the morning for the live stream!". Obviously that text should go away when the stream starts. Unfortunately the stream starts around 3am (9am in Amsterdam). So I wrote this JavaScript to do it for me, and I'm sure I'll need this next year too.
<head>
<style type="text/css">
div#livestream {
width:560px;
margin:0 auto;
}
div#comeback {
@robertpateii
robertpateii / import-into-evernote.vba
Created June 26, 2012 02:42
import into evernote from excel spreadsheet
Option Explicit
Sub OutputNotesXML()
Dim iRow As Long
Close #1
With ActiveSheet
'For iRow = 2 To 2
Open ThisWorkbook.Path & "\evernote-import.enex" For Output As #1