Skip to content

Instantly share code, notes, and snippets.

View dannylloyd's full-sized avatar

Danny Lloyd dannylloyd

  • University of Arkansas for Medical Sciences
  • Cabot, Arkansas
View GitHub Profile
@dannylloyd
dannylloyd / Information-Hiding-Javascript.js
Created June 1, 2011 18:29 — forked from JayDouglass/Information-Hiding-Javascript.js
Information hiding in JavaScript, private instance variables and methods
function superClass() {
var self = this; // used when you want to reference an instance of this object from private methods
this.PublicIVar = "asdafd";
var privateIVar = "encapsulated";
function PrivateFunction() {
}
this.PublicFunction = function () {
@dannylloyd
dannylloyd / Delimited file Reader.vb
Last active March 23, 2016 18:14
Read delimited text file in vb.net
Using var reader As New TextFieldParser("C:\Users\Danny\Desktop\New Text Document.txt")
reader.HasFieldsEnclosedInQuotes = True
reader.SetDelimiters(New String() {","})
While(Not reader.EndOfData)
Try
Console.WriteLine(reader.LineNumber)
Dim fields As String() = reader.ReadFields()
For Each value As String In fields
Console.WriteLine(value)
Next
@dannylloyd
dannylloyd / gist:1170780
Created August 25, 2011 14:24
Css buttons
<html>
<head>
<style type="text/css">
.button{
display:block;
color:#555555;
height:30px;
line-height:31px;
margin-bottom:14px;
@dannylloyd
dannylloyd / FormatWith Extension.vb
Created October 4, 2011 13:04
Takes argument of dataRow and formats the string with column names
'This "Hello {FirstName} {LastName}".FormatWith(dataRow) is the same as this String.Format("Hello {1} {2}", firstName, lastName)
"Text {ColumnName1} {ColumnName1}".FormatWith(dataRow)
@dannylloyd
dannylloyd / Check All Checkboxes.js
Last active September 27, 2015 11:18
Selects all checkboxes in a asp.net gridview
var gridView = '#<%= gridViewId.ClientID%>';
var checkAll = '#checkBoxId';
$(checkAll).click(function (i, v) {
$('input[type=checkbox]', gridView).prop('checked', this.checked);
});
var checkCount = $('input[type=checkbox]', gridView).length;
$('input[type=checkbox]', gridView).click(function (i, v) {
$(checkAll).prop('checked', $('input:checked', gridView).length == checkCount);
@dannylloyd
dannylloyd / JSONP.js
Created October 4, 2011 18:53
Gets data from jsonp source using jQuery
var url = "http://api.twitter.com/1/statuses/user_timeline/codinghorror.json";
$.getJSON(url + "?callback=?", null, function(tweets) {
for (i in tweets) {
tweet = tweets[i];
$("#result").append(tweet.text + "<hr />");
}
});
' Source : http://stackoverflow.com/questions/2681466/jsonp-with-jquery
@dannylloyd
dannylloyd / GetGists.js
Created October 5, 2011 19:17
Get github gists
function asdf() {
var url = "https://gist.github.com/api/v1/json/gists/dannylloyd";
$.getJSON(url + "?callback=?", null, function(result) {
$.each(result.gists, function(){
console.log(this);
});
});
}
@dannylloyd
dannylloyd / Clearfix.css
Created October 9, 2011 03:02
Fixes problem when float is applied to an element and the following elements are crowded around it
.clearfix:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.clearfix {
@dannylloyd
dannylloyd / EasyFinder.js
Created February 19, 2012 00:05
Red dead redemption social club bounty easy finder
$('.panelBountyHunterUniqueLocations a').each(function(index) {
$(this).parents('div').append(' ' + $(this).attr('title') + '<br/>');
});
$('.panelBountyHunterUniqueLocations div').css({
'background-color': 'black',
'color' : 'white',
'text-align' : 'left',
'width': '500px', 'position' : 'relative',
'font-size' : '12px',
'padding' : '10px 0 10px 0'
@dannylloyd
dannylloyd / Idify.js
Created March 5, 2012 16:10
Displays the id of an input on top of the input as a span tag
$('input[type=text],input[type=password]').each(function(e, ob) {
var input = $(ob);
var id = input.attr('id').replace('ctl00_ContentPlaceHolder1_','');
var parent = input.parent();
var left = input.position().left + 2;
var top = input.position().top;
var idcallout = '<span id="span' + id + '" style="position: absolute; top: ' + top +'px; left: ' + left + 'px;">' + id + '</span>';
$(parent).append(idcallout);
});​