Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Michael Earls cerkit

🎯
Focusing
View GitHub Profile
@cerkit
cerkit / modifyVectorMapBorder.html
Last active Jun 1, 2016
Modify the border on a DevExtreme dxVectorMap widget using jQuery
View modifyVectorMapBorder.html
<div id="mapContainer"></div>
<script type="text/javascript">
// attach map to mapContainer
var map = $("#mapContainer").dxVectorMap({
// config goes here...
}).dxVectorMap('instance');
// remove the border around the map
$("#mapContainer").children("svg:first").children("rect:first").attr("stroke-width", "0");
@cerkit
cerkit / UseAsOrCast.cs
Last active Mar 28, 2016
I have a dilemma. Should I use line 4, 8, 12, or 16?
View UseAsOrCast.cs
// Dilemma, should I use this code:
// NOTE: existingJobDetail.Id is defined as a regular (non-nullable) int.
int? parentJobDetailId = existingJobDetail != null ? existingJobDetail.Id as int? : null;
// Or this code:
int? parentJobDetailId = existingJobDetail != null ? (int?)existingJobDetail.Id : null;
// Or (less likely):
@cerkit
cerkit / SampleMarkdownWithCodeProblem.cs
Created Mar 24, 2016
Markdown with code embedded in a <pre /> tag.
View SampleMarkdownWithCodeProblem.cs
<pre class="line-numbers"><code class="language-csharp">static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
// toggle between words and paragraphs
bool isEven = (i % 2) == 0;
bool isThird = (i % 3) == 0;
LipsumType lipsumType = isEven ? LipsumType.Paragraphs : LipsumType.Words;
// only start with Lorem Ipsum every third call
@cerkit
cerkit / link-to-icon-mapper.js
Last active Feb 16, 2016
This code is used to add Font Awesome fonts to dynamically generated navigation links based on a link-to-icon map. To use this code, make sure you have a reference to Font Awesome (http://fontawesome.io) and jQuery.
View link-to-icon-mapper.js
@cerkit
cerkit / bootstrap_merged_menu_example.php
Last active Jan 2, 2016
Bootstrap Navbar on WordPress with merged menus
View bootstrap_merged_menu_example.php
<nav id="top-navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/" rel="home">
@cerkit
cerkit / FizzBuzz.cs
Last active Dec 2, 2015
Proof that I can write code :)
View FizzBuzz.cs
for (int i = 1; i <= 100; i++)
{
if ((i % 3 == 0) && (i % 5 == 0))
{
Debug.WriteLine("FizzBuzz");
}
else if (i % 3 == 0)
{
Debug.WriteLine("Fizz");
}
View PebbleSettings.html
<!DOCTYPE html>
<html>
<head>
<title>Settings page for Pebble</title>
<meta charset="utf-8" />
<link href="../Content/bootstrap.min.css" rel="stylesheet" />
<link href="../Content/Site.css" rel="stylesheet" />
<script src="../Scripts/bootstrap.min.js"></script>
</head>
<body>
@cerkit
cerkit / HTML Entities
Last active Aug 29, 2015
HTML Entities for parsing HTML within an XML parser (Like .NET System.Xml.XmlDocument)
View HTML Entities
<!DOCTYPE root [
<!ENTITY Aacute "&#193;">
<!ENTITY aacute "&#225;">
<!ENTITY Abreve "&#258;">
<!ENTITY abreve "&#259;">
<!ENTITY ac "&#8766;">
<!ENTITY acd "&#8767;">
<!ENTITY Acirc "&#194;">
<!ENTITY acirc "&#226;">
<!ENTITY acute "&#180;">
@cerkit
cerkit / SampleController.js
Created Sep 23, 2014
AngularJS Client for Basic Authentication - SampleController
View SampleController.js
var baseUrl = 'http://localhost:49587/api';
angular.module('app').controller('SampleController', function ($scope, $http, $cookieStore, Base64) {
$scope.refreshData = function () {
//Used to display the data
if ($cookieStore.get('basicCredentials'))
{
$http.defaults.headers.common['Authorization'] = 'Basic ' + $cookieStore.get('basicCredentials');
}
@cerkit
cerkit / CredentialsController.js
Created Sep 23, 2014
AngularJS Client for Basic authentication - Credentials Controller
View CredentialsController.js
function CredentialsController($scope, $http, $cookieStore, Base64) {
$scope.login = function (userName, password) {
var encodedUserNameAndPassword = Base64.encode(userName + ':' + password);
$http.defaults.headers.common['Authorization'] = 'Basic ' + encodedUserNameAndPassword;
$cookieStore.put('basicCredentials', encodedUserNameAndPassword);
$http.get(baseUrl + '/Values')
.success(function() {
$scope.$broadcast('event:auth-loginConfirmed');
$scope.password = '';
})