Skip to content

Instantly share code, notes, and snippets.

View cakesmith's full-sized avatar

Nick LaRosa cakesmith

  • Diameter Health
  • New Jersey
View GitHub Profile
@cakesmith
cakesmith / balancedPatternMatcher.cs
Created November 19, 2015 20:14 — forked from anonymous/balancedPatternMatcher.cs
Balanced pattern matcher regular expression generator
// Match everything inside balancing groups ['<' and '>'] (Variables) and ['{' and '}'] (Macros)
// ex: <This is A Variable> and {This is a macro}
// http://goo.gl/Rjo6Ih
public static string PatternBuilder(char open, char close)
{
return $"(((?<open>{open})[^{open}]*)+([^{open}]*(?<close-open>{close}))+).*?(?(open)(?!))";
}
public static string caretPattern => PatternBuilder('<', '>');
@cakesmith
cakesmith / gist:686c3ba6dbb0944b1db3
Created August 1, 2015 14:24
Disable VirtualBox Time Sync
Turn off time syncing:
vboxmanage setextradata [VMname] "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"
Turn it back on:
vboxmanage setextradata [VMname] "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "0"
[gui]
[user]
name = Nicholas LaRosa
email = [email protected]
[core]
autocrlf = false
safecrlf = true
excludesfile = C:\\Users\\nicholas.larosa\\Documents\\gitignore_global.txt
filemode = false
whitespace = fix
@cakesmith
cakesmith / BaseClass.cs
Created May 13, 2015 15:30
C# Singleton pattern with inheritence
namespace Program
{
public abstract class BaseClass
{
public BaseClass {
// Constructor
}
}
}
@cakesmith
cakesmith / CheckChildren.cs
Created April 22, 2015 23:17
Check all children in a TreeView
// Updates all child tree nodes recursively.
private void CheckAllChildNodes(TreeNode treeNode, bool nodeChecked)
{
foreach (TreeNode node in treeNode.Nodes)
{
node.Checked = nodeChecked;
if (node.Nodes.Count > 0)
{
// If the current node has child nodes, call the CheckAllChildsNodes method recursively.
@cakesmith
cakesmith / MyTreeView.cs
Created April 22, 2015 23:14
Bug Fix for TreeView Component checkbox (doubleclick)
using System;
using System.Windows.Forms;
public class MyTreeView : TreeView {
protected override void WndProc(ref Message m) {
// Suppress WM_LBUTTONDBLCLK
if (m.Msg == 0x203) { m.Result = IntPtr.Zero; }
else base.WndProc(ref m);
}
}
import Graphics.Element (..)
import Graphics.Input.Field as Field
import Signal
import List (head)
import Char (..)
import String (length, slice, toList, indexes, cons, map)
import Text (plainText)
content : Signal.Channel Field.Content
content =
@cakesmith
cakesmith / index.html
Created August 5, 2014 17:54
[AngularJS] Overriding directives with a decorator....A Pen by Nick LaRosa.
<div ng-app="codepen">
<a href="" class="blue">Not Yellow</a>
<br>
<a href="" class="overridden">Yellowish</a>
</div>
(function (app) {
'use strict';
app.config(function($urlRouterProvider, $stateProvider) {
$stateProvider
.state('landing', {
url: '/landing',
templateUrl: '/states/landing/landing.html'
});
@cakesmith
cakesmith / index.html
Last active August 29, 2015 14:04
bootstrap offcanvas navigation
/*
* Style tweaks
* --------------------------------------------------
*/
html,
body {
overflow-x: hidden; /* Prevent scroll on narrow devices */
}
body {