Skip to content

Instantly share code, notes, and snippets.

View Ryanb58's full-sized avatar

Taylor Brazelton Ryanb58

View GitHub Profile
@Ryanb58
Ryanb58 / ImageUpload
Created July 21, 2014 18:50
Asp.net C# Windows Forms Upload Image
// logoUpload is the name of the .net upload control.
string sSavePath = "/images/";
if (logoUpload.PostedFile != null)
{
HttpPostedFile myLogo = logoUpload.PostedFile;
//Check Length.
int nFileLen = myLogo.ContentLength;
@Ryanb58
Ryanb58 / fizzbuzz.py
Last active August 29, 2015 14:08
Fizz Buzz challenge in python.
for num in range(1, 101):
if num % 3 == 0 and num % 5 == 0:
print('FizzBuzz');
elif num % 3 == 0:
print('Fizz');
elif num % 5 == 0:
print('Buzz');
else:
print(num);
@Ryanb58
Ryanb58 / StringReverser.py
Created October 23, 2014 22:22
Simple String reversal program.
reme = 'em esrever'
print(reme)
mere = ''
L = list(reme)
num = len(reme) - 1
while num >= 0:
#print(reme[num])
mere+=reme[num]
num-=1
#print(reme[num])
@Ryanb58
Ryanb58 / FinalProject.py
Created November 21, 2014 03:28
Freshman Year 9Gag Viewer in Python
'''
9GAG Viewer
Created by Taylor Brazelton
All Rights are Reserved to their respected owners.
I do not own any of the images viewed by this program and therefore take no responsibility.
'''
'''
Funny Picture Viewer / 9GAG Viewer
@Ryanb58
Ryanb58 / DoNotRepeatRandomItemGetter.js
Created December 29, 2014 07:14
Simple script that records it's history so as not to repeat itself two times in a row...
var gameMaster = "Ryanb58";
var listOfPlayers = ['Taylor','Ryanb58','Jack','John','Kyle'];
var playerNumber;
for(i=0; i<25; i++)
{
//console.log("Current GM: " + gameMaster);
playerNumber = listOfPlayers.indexOf(gameMaster);
while(gameMaster == listOfPlayers[playerNumber])
@Ryanb58
Ryanb58 / DataViewRowFilterViaQueryStrings.cs
Created March 12, 2015 18:32
Simple function that builds a row filter query via the parameters in the querystring. Checks to ensure that the key matches a column in the dataviewer.
private void getSearchQueryFromQueryString()
{
try
{
//String for row query.
StringBuilder sb = new StringBuilder();
//Get all the information in the query strings.
NameValueCollection querystrings = Request.QueryString;
@Ryanb58
Ryanb58 / PowerShellCommandsAndScripts
Created May 14, 2015 13:30
Useful PowerShell commands and scripts.
#To view the connected file system drives:
gdr -PSProvider 'FileSystem'
@Ryanb58
Ryanb58 / perfect_squares_with_vectors.cpp
Created November 30, 2015 02:32
C++ Perfect Square using a vector to hold the results.
#include <iostream>
#include <istream>
#include <vector>
#include <string>
using namespace std;
int main() {
string input;
@Ryanb58
Ryanb58 / loadData.cs
Last active December 20, 2015 02:19
Code to connect to API via HttpWebRequest API and get the JSON results returned into a dynamic object... JSON.net req.
public void LoadData(Uri uri)
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.BeginGetResponse(new AsyncCallback(ReadWebRequestCallback), request);
}
private void ReadWebRequestCallback(IAsyncResult callbackResult)
{
try
{
@Ryanb58
Ryanb58 / dict_to_params.js
Created January 5, 2016 16:36
JavaScript dictionary to query string or params script.
params_dict = {
'name':'New Rule',
'type': 'user',
};
// URL Builder from DICT.
params = "";
index = 0;
for (var key in params_dict) {
if (index == 0) {