This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/* copy input to output; 1st version */ | |
main() | |
{ | |
int c; | |
c = getchar(); | |
while (c != EOF) { | |
putchar(c); | |
c = getchar(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
namespace OOP | |
{ | |
public class Program | |
{ | |
private const string QUIT = "q"; | |
public static void Main (string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//helper function | |
$.parseUrl = function(str) { | |
var match = str.match(/\/([^/]+)\/$/); | |
var a = match[1]; | |
return a; | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
//This function will add placeholder text to IE | |
$.setPlaceHolderText = function() { | |
var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input'); | |
if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) { | |
return; | |
} | |
$(':input[placeholder]').each(function() { | |
var el = $(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var productExists = function() { | |
var prod = $("#product_ok").css('display'); | |
var brand = $("#brand_ok").css('display'); | |
var btn = $("#btnSubmit"); | |
if (prod != 'none' && brand != 'none') { | |
btn.attr('disabled', 'disabled'); | |
btn.text("This product already exists"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate_add_another(add_another_msg, forgot_to_select_msg, last_product_msg, formset, request): | |
if 'add_another' in request.POST: | |
result = filter(lambda x : x.cleaned_data['select'], formset.forms) | |
#if this our last product to add and its been selected then just tell them it was saved, not to add another | |
if len(result) == len(formset.forms): | |
return last_product_msg | |
#if they hit the add another while selecting products (and its not the last product) tell them to add more | |
elif any(result): | |
return add_another_msg | |
#if they hit the save and add another button but forget to assign |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Collections; | |
namespace StockTickerApp | |
{ | |
class Program | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ctype.h> | |
#include <stdio.h> | |
#include <ctype.h> | |
#include <limits.h> | |
#include <stdlib.h> | |
int is_numeric(char str[]) | |
{ | |
int i, v, d, n; | |
double l, j; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*lower:convert c to lowercase; ASCII only*/ | |
int lower(int c) | |
{ | |
if (c >= 'A' && c <= 'Z') | |
return c +'a'-'A'; | |
else | |
return c; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def invFinder(a): #O(n^2) :-/ | |
list = [] | |
for i,j in enumerate(a): | |
for k,l in enumerate(a): | |
if i < k and j > l: | |
list.append((j,l,)) | |
return list |