Skip to content

Instantly share code, notes, and snippets.

View greggnakamura's full-sized avatar

Gregg Nakamura greggnakamura

View GitHub Profile
@greggnakamura
greggnakamura / ember.object.js
Last active March 29, 2016 04:04
EmberJS: Ember.Object example
// emberjs cookbook: chapter2/example1/app/myObject.js
/*
Ember.Object is the base class for almost every other Ember object.
Routes, models, views, and components all inherit from Ember.Object.
It's used everywhere.
*/
import Ember from 'ember';
** git diff --name-only 102439 HEAD
C:\inetpub\wwwroot\Wakefly\Websites\MHI\members-health-insurance-mhinsurance.com\CMS>git diff --name-only 102439 HEAD
CMS/App_Code/Global.asax.cs
CMS/CMSScripts/Custom/addthis_widget.js
CMS/CMSScripts/Custom/inline.js
CMS/CMSScripts/Custom/jquery-cycle-all-min.js
CMS/CMSScripts/Custom/jquery.noty.packaged.min.js
CMS/CMSScripts/Custom/main.js
CMS/CMSScripts/Custom/main.js.old
@greggnakamura
greggnakamura / web.config.xml
Created March 4, 2016 16:40
web.config: Add 'www' to HTTP or HTTPS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Add www to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.site2\.com$" negate="true" />
<add input="{HTTPS}" pattern="On" />
@greggnakamura
greggnakamura / js-jquery-snippets.js
Created February 1, 2016 18:16
Javascript / jQuery: Snippets
// strip html tags from string
// https://css-tricks.com/snippets/javascript/strip-html-tags-in-javascript/
(function ($) {
var strippedString, items = $('.selector');
$.each(items, function (value) {
var currentText = $(this).text();
strippedString = currentText.replace(/(<([^>]+)>)/ig,"");
$(this).html(strippedString);
});
@greggnakamura
greggnakamura / index.hbs
Last active November 16, 2015 04:38
Javascript: Handlebars JS basic template example
<script id="template" type="text/x-handlebars-template">
<p>Use the <strong>{{power}}</strong>, {{name}}!</p>
</script>
{!-- http://www.sitepoint.com/overview-javascript-templating-engines/ --}
{!-- output: Use the force, Luke! --}
@greggnakamura
greggnakamura / default.aspx
Last active November 2, 2015 19:05
IIS: Rewrite Maps in URL Rewrite Module
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>URL Rewrite Module Test</title>
</head>
<body>
<h1>URL Rewrite Module Test Page</h1>
<table>
@greggnakamura
greggnakamura / IIS: URL Rewrite Cheat Sheet
Last active November 14, 2015 00:30 — forked from developerdizzle/IIS Rewrite Cheat Sheet
IIS: URL Rewrite Cheat Sheet
<rewrite>
<!-- Have a bunch of redirects? Put them in a separate file -->
<rules configSource="Rewrites.config" />
<rules>
<!-- Simple rewrite -->
<rule name="Simple rewrite" stopProcessing="true">
<match url="^path/sub path/page\.aspx$" />
<action type="Rewrite" url="/newpath.aspx" />
@greggnakamura
greggnakamura / web.config.xml
Created August 27, 2015 23:44
URL Rewrite: Add HTTP_Host to allow redirects to work on localhost
<rule name="Rewrite rule2 for Redirects" stopProcessing="true">
<match url="GFB" />
<!-- localhost -->
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
<add input="{HTTP_HOST}" pattern="localhost" negate="true" />
</conditions>
<!-- localhost -->
@greggnakamura
greggnakamura / EventsController.cs
Last active January 12, 2016 16:01
ASP.NET MVC: DataTables w/AJAX example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Quantech_mda.mil.Controllers
{
[Authorize(Roles = "SuperUser")]
public class EventsController : BaseController
@greggnakamura
greggnakamura / gist:95e6325c930124b2d988
Created June 19, 2015 00:34
Jekyll: Development and Production environments
http://stackoverflow.com/questions/27386169/change-site-url-to-localhost-during-jekyll-local-development
Let's say we have the local site served at http://localhost and the production site served at https://username.github.io/myProject.
We leave the _config.yml with url: https://username.github.io and baseurl: /myProject
We create a new _config_dev.yml with only url: https://localhost and baseurl: ""
Now to test locally :