Skip to content

Instantly share code, notes, and snippets.

@stevereich
stevereich / toggleAdministratorAccount.bat
Created May 19, 2015 21:51
This file will enable/disable the Windows built-in administrator account. This account is disabled by default, but is sometimes needed in order to have certain permissions. Be sure you run this file as administrator or assign the appropriate permissions to execute it.
:: This will enable/disable the Windows built-in administrator account.
:: Run this file as "Run as administrator", and then at the prompt, enter
:: one of the following options: y | n | yes | no ... the /i flag makes the
:: options case insensitive, so either capital or lower case is accepted.
:: Enter any other value, or no value at all, will return an error message
:: and not run the command.
ECHO OFF
SETLOCAL
SET /P doAdmin="Enable Windows built-in administrator account? (y/n) "
IF /i "%doAdmin%" EQU "n" SET doAdmin=no
@stevereich
stevereich / weatherApi.js
Last active August 29, 2015 14:19
This is a simple javascript wrapper for the Weather Underground API. There are no dependencies and you can get an API Key at http://www.wunderground.com/weather/api/
var WeatherAPI = function(){
// create any default settings
var apiSettings = {
defaultIcons: 'f'
}
this.apiMethods = [
'alerts',
'almanac',
'astronomy',
'conditions',
@stevereich
stevereich / toggleiconz.ahk
Last active August 29, 2015 14:06
This is an Autohotkey script that toggles between showing and hiding desktop icons in Windows. Website at http://www.toggleiconz.com
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UNLICENSE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ToggleIconz is free and unencumbered software hereby released into the public domain on September 12, 2014
; by the original developer, Steve Reich`r`n`r`nAnyone is free to copy`, modify`, publish`, use`, compile`,
; sell`, or distribute this software`, either in source code form or as a compiled binary`, for any purpose`,
; commercial or non-commercial`, and by any means.
;
; In jurisdictions that recognize copyright laws`, the author or authors of this software dedicate any and all
; copyright interest in the software to the public domain. We make this dedication for the benefit of the public
; at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of
@stevereich
stevereich / highlightKeywords.cfm
Last active August 29, 2015 14:01
Coldfusion function using regex find and highlight, or apply any other style to, keywords searched in a given text string.
<cfscript>
public string function highlightKeywords(required string content,required array keywords,required array style){
var replaceString = "<span style=""" & arraytolist(arguments.style,";") & """>\1</span>";
var kwords = arraytolist(arguments.keywords, "\b|\b");
kwords = "\b" & kwords & "\b";
kwords = reReplacenocase(kwords,"(\%\\b|\\b\%)","","ALL");
var resultString = reReplacenocase(arguments.content,"(#kwords#)",replaceString,"ALL");
return resultString;
}
// input text

Fixed Background Illusion

This bit of CSS demonstrates how two fixed backgrounds (in this case, one black and white, the other color) can be layered so that the view port div of the top layer, appears to change the state of the bottom layer. This effect works well with a blurred/clear image as well. Your imagination is the limit! Enjoy!

A Pen by Steve Reich on CodePen.

License.

@stevereich
stevereich / applicationFilters.cfm
Created October 17, 2012 06:22
Setting a CFC Object as an application variable in Coldfusion
<cfscript>
application.filters = CreateObject("component", "myCFCs.filters").init(application.settings.dsn_filters); //pass datasource to object
</cfscript>
@stevereich
stevereich / charLength.sql
Created October 14, 2012 23:28
SQL Query ordering by character length.
SELECT
*
FROM
badwords
ORDER BY CHAR_LENGTH(strBadWord) DESC
@stevereich
stevereich / shuffle.cfm
Created October 13, 2012 01:50
Shuffle Array with Coldfusion
<cfscript>
CreateObject( "java", "java.util.Collections" ).Shuffle(variables.badwordArray);
</cfscript>
@stevereich
stevereich / ajax_badwords.cfm
Created October 13, 2012 01:45
Coldfusion handler for bad words filter.
<cfscript>
if(structkeyexists(form, "filterBox")){
variables.checkString = form.filterBox;
if(structKeyexists(form, "replaceString")){
if(form.replaceString EQ "0"){
variables.cleanText = application.filters.filterWords(variables.checkString,0);
}
else{
variables.cleanText = application.filters.filterWords(variables.checkString,1);
}
@stevereich
stevereich / wordFilter.cfm
Created October 13, 2012 01:42
Form to demonstrate the bad word filter.cfc
<html>
<head>
<title>Bad Word Filter</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script language="JavaScript" type="text/javascript">
$(function(){
$filterBox = $('#filterBox');
$frmWords = $('#frmWords');
$thewords = $('#thewords');
$buttonCheck = $('#buttonCheck').click(function(){