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
#!/bin/bash | |
echo "Running deployment script..." | |
CURRENT_COMMIT=`git rev-parse HEAD` | |
# Change the branch used if applicable (e.g. gh-pages) | |
echo "Cloning master branch..." | |
# Hide output since we use an access token here | |
git clone -b master "https://${GH_TOKEN}@${GH_REF}" _deploy > /dev/null 2>&1 || exit 1 |
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 Travis = require('travis-ci'); | |
// change this | |
var repo = "kamranayub/kamranayub.github.io"; | |
var travis = new Travis({ | |
version: '2.0.0' | |
}); | |
travis.authenticate({ |
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
/// <summary> | |
/// Formats a JSON string by walking through it and examining the contents. | |
/// </summary> | |
/// <param name="json">Unformatted JSON string, expects valid JSON with quoted keys and no whitespace.</param> | |
/// <returns>Formatted JSON string</returns> | |
/// <remarks> | |
/// [ { should have line breaks and tabs after them | |
/// ] } should have line breaks and tabs before them | |
/// : should have a space after it | |
/// , should have a line break and tab |
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
/// <summary> | |
/// Will transform "some $ugly ###url wit[]h spaces" into "some-ugly-url-with-spaces" | |
/// </summary> | |
public static string Slugify(this string phrase, int maxLength = 50) | |
{ | |
string str = phrase.ToLower(); | |
// invalid chars, make into spaces | |
str = Regex.Replace(str, @"[^a-z0-9\s-]", ""); | |
// convert multiple spaces/hyphens into one space |
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
/* add using statements */ | |
public static class HtmlExtensions { | |
/// <summary> | |
/// Generates a better label. | |
/// Text based off given labelText, [DisplayName], or property name. | |
/// If the field is optional ([Required]), adds an (optional) em tag. | |
/// If the field has a description ([Description]), adds a class="note" span tag. | |
/// </summary> | |
/// <typeparam name="TModel"></typeparam> |
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
public static MvcHtmlString DropdownForEnum<TModel>(this HtmlHelper<TModel> helper, Type type, | |
string name, string optionLabel, object htmlAttributes) | |
{ | |
if (!type.IsEnum) throw new ArgumentException("type must be that of an enum", "type"); | |
var dictionary = new Dictionary<string, string>(); | |
var values = type.GetEnumValues(); | |
foreach (var val in values) |
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.Diagnostics; | |
namespace PerfBackingFields | |
{ | |
class Program | |
{ | |
private const int Iterations = 100000; | |
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
/// <summary> | |
/// An exclude directory search for Cassette. Provide the patterns you want to search for | |
/// and this will exclude *.min/*-vsdoc files as well as the directories you specify. | |
/// </summary> | |
public class ExcludeDirectorySearch : FileSearch | |
{ | |
/// <summary> | |
/// Excludes specified directories in search (also .min and -vsdoc files) | |
/// </summary> | |
/// <param name="pattern">File search pattern (wildcards, e.g. *.css;*.less)</param> |
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
// jQuery.tmpl Compiled Source Plugin for Knockout 2.0 | |
// Kamran Ayub - http://kamranicus.com | |
// | |
// Adds support for referencing named pre-compiled templates | |
// e.g. $.template('name', 'markup') | |
// | |
// Specifically, this makes Cassette Knockout compiled templates | |
// work in KO 2.0.0 | |
(function (ko) { | |
ko.templateSources.compiledTemplateSource = function (name) { |
OlderNewer