Skip to content

Instantly share code, notes, and snippets.

View JustinK's full-sized avatar

Justin Kelly JustinK

View GitHub Profile
@JustinK
JustinK / 1-index.html
Last active August 29, 2015 14:08
User Directory Template
<!-- index.html -->
<!DOCTYPE html>
<html ng-app="directoryApp">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
//Swift
var primate = "monkey"
var delicousTreat: String = "donut"
let plant = "pine tree"
func combineThings(thing1: String, thing2: String) -> String{
let newThing = thing1 + " " + thing2
return newThing
}
<asp:DropDownList ID="cboCategory" runat="server"></asp:DropDownList>
<select id="cboType"></select>
@JustinK
JustinK / demo.js
Last active August 29, 2015 14:08
$('#cboCategory').change(function () {
var categoryId = $(this).val();
loadTypeList(categoryId);
});
function loadTypeList(categoryId) {
$.ajax({
type: 'POST',
url: 'Example.aspx/GetTypeList',
data: '{categoryId: "' + categoryId + '" }',
@JustinK
JustinK / demo.cs
Last active August 29, 2015 14:08
[WebMethod]
public static List<Type> GetTypeList(string categoryId)
{
var types = new List&ltType&gt
{
new Type(){ Name = "Red", Id=1, CategoryId=5 },
new Type(){ Name = "Blue", Id=2, CategoryId=5 },
new Type(){ Name = "Green", Id=3, CategoryId=3 }
};
var catId = Convert.ToInt32(categoryId);
<telerik:RadAsyncUpload ID="asyncUpload" runat="server" AllowedFileExtensions="pdf,jpg,jpeg,png" OnClientFileSelected="OnClientFileSelected"></telerik:RadAsyncUpload>
<asp:HiddenField runat="server" ID="hiddenFile"/>
function OnClientFileSelected(sender, args) {
var fileInput = sender;
//get the file from the input field
var file = args.get_fileInputField().files[0];
var imageType = /image.*/;
//stop the image from uploading to the temp storage on the server
if (file.type === 'image/jpeg') {
sender.pauseUpload();
$('.ruUploadProgress').addClass('ruUploadSuccess');
var imageFile = hiddenFile.Value;
String img = imageFile.Replace("data:image/jpeg;base64,", "").Replace(" ", "+");
byte[] b = Convert.FromBase64String(img);
var timestamp = DateTime.Now.ToString("yyyy_MM_dd_HHmmssfff");
var virtualDirectoryPath = "~/Receipts/" + year + "/";
var fileName = Path.Combine(page.Server.MapPath(virtualDirectoryPath),
timestamp + ".jpg");
System.IO.File.WriteAllBytes(fileName, bytes);
@JustinK
JustinK / index.html
Last active June 14, 2024 15:16
MapMyRun API Demo
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-12">
<!-- This is where we are going to put the graph -->
@JustinK
JustinK / ocp.cs
Last active August 29, 2015 14:08
SOLID - Open Closed Principle
//NOT SO GOOD
public class Car
{
public bool IsBus {get; set;}
public bool HasTurbo {get; set;}
public int NumberOfPistons {get; set;}
public double TotalWeight {get; set;}
abstract public double GetHorsePower(){