This file contains hidden or 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.Web; | |
namespace System.Web.Mvc.Html | |
{ | |
public class ImageSelectListItem : SelectListItem | |
{ | |
public string ImageFileName { get; set; } |
This file contains hidden or 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
internal static string ListItemToOption(ImageSelectListItem item, string imagePath = "") | |
{ | |
//if (!(item is ImageSelectListItem)) | |
//{ | |
// throw new InvalidCastException(string.Format("Cannot cast {0} to System.Web.Mvc.Html.ImageImageSelectListItem.", item.GetType())); | |
//} | |
//ImageSelectListItem imageImageSelectListItem = item as ImageSelectListItem; | |
TagBuilder builder = new TagBuilder("option") |
This file contains hidden or 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
####################################################################################################################### | |
# This Gist is some crib notes/tests/practice/whatever for talking to Active Directory via LDAP. The (surprisingly | |
# helpful) documentation for Net::LDAP can be found here: http://net-ldap.rubyforge.org/Net/LDAP.html | |
####################################################################################################################### | |
require 'rubygems' | |
require 'net/ldap' | |
####################################################################################################################### | |
# HELPER/UTILITY METHOD |
This file contains hidden or 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
// "Ajaxify" the will_paginate control. | |
$(".pagination a").live("click", function() { | |
$(".pagination").html("Loading..."); | |
$.getScript(this.href); | |
return false; | |
}); | |
// For reference, here's what the html in the Rails view looks like: | |
// <div class="pagination pagination-centered"> | |
// <%= will_paginate %> |
This file contains hidden or 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
# If you see this error when trying to start MySQL: "Another MySQL daemon already running with the same unix socket.", run this to fix it: | |
sudo mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak |
This file contains hidden or 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
<VirtualHost *:80> | |
ServerName # put my server name here | |
## Vhost docroot | |
DocumentRoot /path/to/app/root # if your app's root directory is /opt/myapp, this should be set to /opt | |
## Alias declarations for resources outside the DocumentRoot | |
Alias /myapp /path/to/app/public/directory # if your app's root directory is /opt/myapp this should be set to /opt/myapp/public | |
Alias /assets /path/to/app/public/assets/directory # if your app's root directory is /opt/myapp this should be set to /opt/myapp/public/assets | |
## Directories, there should at least be a declaration for /opt/myapp/public |
This file contains hidden or 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
# The Passanger Apache module configuration file is being | |
# managed by Puppet and changes will be overwritten. | |
<IfModule mod_passenger.c> | |
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p484/gems/passenger-3.0.21 | |
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p484/ruby | |
PassengerMaxPoolSize 30 | |
PassengerPoolIdleTime 300 | |
PassengerDefaultUser appuser # set this to whoever owns the directories for your Rails app | |
</IfModule> |
This file contains hidden or 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
// In app.js or main.js or whatever: | |
// var myApp = angular.module('askchisne', ['ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ui.bootstrap.tpls']); | |
// This filter makes the assumption that the input will be in decimal form (i.e. 17% is 0.17). | |
myApp.filter('percentage', ['$filter', function ($filter) { | |
return function (input, decimals) { | |
return $filter('number')(input * 100, decimals) + '%'; | |
}; | |
}]); |
This file contains hidden or 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
// Came from the comments here: https://gist.github.com/maruf-nc/5625869 | |
app.filter('titlecase', function() { | |
return function (input) { | |
var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i; | |
input = input.toLowerCase(); | |
return input.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function(match, index, title) { | |
if (index > 0 && index + match.length !== title.length && | |
match.search(smallWords) > -1 && title.charAt(index - 2) !== ":" && | |
(title.charAt(index + match.length) !== '-' || title.charAt(index - 1) === '-') && |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Table Hover CSS Test</title> | |
<style> | |
th { | |
font-weight: bold; | |
font-size: 16px; | |
text-align: center; | |
} |
OlderNewer