Skip to content

Instantly share code, notes, and snippets.

View scottsappen's full-sized avatar

Scott Sappenfield scottsappen

View GitHub Profile
I decided to make the text follow the mouse.
First, download JqueryUI and place it in your usual js location. This library gives you all kinds of nice stuff, like moving a <div> around a page that follows your mouse.
<script src="/js/vendor/jquery-ui.min.js"></script>
Here’s my <div> by the way, this is what I’ll be using.
<div id="forworldmapcomment" style="position:absolute;"></div>
In your $(document).ready(function() {}); function add this:
$("#forworldmap").mousemove(function(e){
@scottsappen
scottsappen / gist:5901601
Created July 1, 2013 15:00
Simple drop down menu
I really like this post out on http://css-tricks.com/simple-jquery-dropdowns/
1. Download the files
2. Include this in your code
<script src="../Scripts/jquery.dropdownPlain.js" type="text/javascript"></script>
3. Create a menu
<div id="dropdownmenu">
<ul class="dropdown">
@scottsappen
scottsappen / gist:5901614
Created July 1, 2013 15:01
HTML5 Session Storage example of loading a blog roll every so often, not all the time
//this function will load blog roll from sessionstorage or go get it if need be
function doLoadBlogRoll()
{
var sessionKey = "postsInSession";
//if browser supports session storage, try to use it
if (sessionStorage) {
var sessionValue = sessionStorage.getItem(sessionKey);
if (sessionValue) {
// update website
$("#div_blogroll").html(sessionValue); // We just avoided one ajax request
//Call this function which will do the work of rendering if needed
visChange();
//check if the div_blogroll is visible on the page, if so, render it
function visChange() {
var divBlog = document.getElementById('div_blogroll');
if (divBlog) {
if (!isHidden())
doLoadBlogRoll();
}
@scottsappen
scottsappen / gist:5901644
Created July 1, 2013 15:05
iOS Label Animation (pre-IOS 6)
@property (weak, nonatomic) IBOutlet UILabel *LabelNotifications;
@synthesize LabelNotifications = _labelNotifications;
//viewDidLoad method
[_labelNotifications setAlpha:0.0];
_labelNotifications.text = @"I am a label. I am going to fade in and out for the user!";
[UIView animateWithDuration:2.0
delay:0.0
@scottsappen
scottsappen / gist:5901745
Created July 1, 2013 15:17
Sometimes you just want a simple modal dialog box that works in most browsers without too much to do about it. Jquery makes it so easy.
1. Identify a div tag that contains the content you want to popup and display.
In this case, we have a div tag called dialog_betamode.
We also have an element called floating_betamode that we will click to launch the dialog.
2. Put this in your initialization area
$(function () {
var dlg = $("#dialog_betamode").dialog({
autoOpen: false,
show: "blind",
modal: true,
<script src="../Scripts/jquery.Jcrop.min.js" type="text/javascript"></script>
<style type="text/css" media="all">@import "../Styles/jquery.Jcrop.css";</style>
<img id="mycroppable" src="#yoururl" title=""/>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
function setImageCropCoords(c) {
// variables can be accessed here as
@scottsappen
scottsappen / gist:5901755
Created July 1, 2013 15:18
Smooth Scroll To
<div id="div_scrollhere"></div>
$("html,body").animate({ scrollTop: $("#div_scrollhere").offset().top }, 1000);
@scottsappen
scottsappen / gist:5901768
Created July 1, 2013 15:20
great WYSIWYG editors out there for your web pages http://www.tinymce.com/
<script src="../Scripts/tinymce/jscripts/tiny_mce/tiny_mce.js" type="text/javascript"></script>
<textarea id="textarea_text" rows="20" cols="20" runat="server" class="tinymce" />
tinyMCE.init({
mode: "specific_textareas",
editor_selector: "tinymce",
encoding: "xml",
height: "600",
width: "100%",
@scottsappen
scottsappen / gist:5901792
Created July 1, 2013 15:23
Reset a 100Mbs Cisco Catalyst 2900 Series XL
Got the admin password?
Ok, connect to it on COM1 using 9600 baud, no parity, 8 data bits, 1 stop bit
switch>en
switch>write erase
switch>reload
switch>show vlan (you should now see that only default vlan settings are present indicating everything has been wiped)
Don't got the admin password?