Skip to content

Instantly share code, notes, and snippets.

View nathggns's full-sized avatar

Nate Higgins nathggns

View GitHub Profile
@nathggns
nathggns / minmax.js
Created August 14, 2011 21:11
Largest / Smallest value in an array
Array.prototype.max = function() {
var max = this[0];
var len = this.length;
for (var i = 1; i < len; i++) if (this[i] > max) max = this[i];
return max;
}
Array.prototype.min = function() {
var min = this[0];
var len = this.length;
@nathggns
nathggns / prefixed.php
Created August 14, 2011 21:41
Add numbers with a prefixed 0 together
<?php
echo (int) 01 + (int) 02;
?>
String.prototype.trim = function ()
{
return this.replace(/^\s*([\S\s]*?)\s*$/, '$1');
}
function centerMain()
{
$('#main').css({
position: 'absolute',
top: '50%',
@nathggns
nathggns / ticker.html
Created August 22, 2011 21:02
Ticker
(function($) {
$.fn.ticker = function(options) {
var settings = {
delay: 500,
speed: 600,
repeat: false
}
tick = function(id) {
@nathggns
nathggns / ticker.html
Created August 22, 2011 21:07
Ticker
(function($) {
$.fn.ticker = function(options) {
var settings = {
delay: 500,
speed: 600,
repeat: false,
callback: false
}
@nathggns
nathggns / ticker.js
Created August 22, 2011 21:46
A great ticker written by Nathaniel Higgins
(function($) {
$.fn.ticker = function(options) {
var settings = {
delay: 500,
speed: 600,
repeat: false,
callback: false
}
@nathggns
nathggns / tickerExample.js
Created August 22, 2011 21:48
An Example Use of my ticker script
$('p').ticker({
repeat: true,
callback: function(tick) {
// tick is the amount of times it has scrolled already. Without repeat: true will always be 1
switch(tick) {
case 1:
$(this).text('Random News 2');
break;
case 2:
@nathggns
nathggns / ticker.html
Created August 22, 2011 22:18
Full Source code for Harley McKittrick
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>jQuery News Ticker</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
(function($) {
$.fn.ticker = function(options) {
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>jQuery News Ticker</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
(function($) {
$.fn.ticker = function(options) {
@nathggns
nathggns / index.php
Created August 29, 2011 11:59
Wierd Error: strpos() [function.strpos]: Empty delimiter
foreach ($split as $place => $line) {
if (strpos('}', $line)) {
$n--;
}
$prefix = str_repeat("\t", $n);
if (strpos('{', $line)) {
$n++;
}