Skip to content

Instantly share code, notes, and snippets.

View rionmonster's full-sized avatar

Rion Williams rionmonster

View GitHub Profile
@model IEnumerable<string>
<ul>
@foreach(var item in Model){
<li>@item</li>
}
</ul>
/* Inline approach */
function showDiv(elem){
// If your value is not "Select", then show the next option
document.getElementById('stepsHIDDEN').style.display = (elem.value != 'Select') ? "block" : "none";
// If your value is "foo", then show another element
document.getElementById('showMeOn42').style.display = (elem.value == '42') ? "block" : "none";
}
/* Switch statement approach */
function showDiv(elem){
// Keep track of how many users you have pulled
var usersPulled = 0;
// Every 5 seconds, pull a user
var userTimer = setTimeout(function(){ pullUser(); }, 5000);
function pullUser(){
// Make an AJAX call to pull your specific user
$.get('/Users/Get', { skip: usersPulled++ }, function(user){
if(user)
Dictionary<Account,bool> comparisons = new Dictionary<Account,bool>();
// Populate your dictionary
comparisons = Accounts.ToDictionary(k => k, x.modification_date > modification_date);
// Place a breakpoint here to compare true/false values
public class HomeController : Controller
{
[HttpGet]
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(string posted)
$("#customFields").on('click','.remCF',function(){
// Push back the reference since one was removed
var previousIndex = possibleLetters.indexOf(currentLetter) - 1;
currentLetter = possibleLetters[previousIndex];
$(this).parent().parent().remove();
});
#mc_embed_signup{
background:#fff;
clear:left;
font:14px Helvetica, Arial,sans-serif;
width:290px;
text-align: center!important;
}
#mc-embedded-subscribe {
background-color: #000!important;
border-radius: 0!important;
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CheckBoxChecking.aspx.cs" Inherits="Example.CheckBoxChecking" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
namespace ExampleProject.Controllers
{
public class HomeController : Controller
{
[HttpGet]
public ActionResult Index()
{
return View();
}
<button class='Remove' data-id='42'>Click Me!</button>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script>
$(function(){
$('.Remove').click(function () {
debugger;
var myId = $(this).data('id');
$.ajax({
url: '@Url.Action("Remove", "ReadingNow")?Book_id=' + myId,
success: function (response) {