Skip to content

Instantly share code, notes, and snippets.

Hugo Bonacci hugoware

Block or report user

Report or block hugoware

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
hugoware /
Created Jan 22, 2015
Theme via File Path in Sublime Text 3
# checks settings and changes the theme depending on the file location
# default_folder_theme: string of the theme to use normally
# folder_themes: object with key/value of find/theme
# ex: {
# "trunk": "Packages/User/trunk.tmTheme",
# "alt/folder": "Packages/User/darkUi.tmTheme"
# }
import sublime
import sublime_plugin
# Sublime Plugin that will take the selected text(s)
# and replace it with a variable name you provide. The name and
# values are then prepended to the top of the file
import sublime, sublime_plugin, re
# handles asking for what to replace the selection with
class PromoteCssCommand( sublime_plugin.WindowCommand ):
def run( self ):
hugoware / roc.js
Last active Aug 29, 2015
Lightweight HTTP server for Node for front end development
View roc.js
var $ = module.exports
, $fs = require('fs')
, $path = require('path')
, $http = require('http')
, $query = require('querystring')
, $run = require('child_process').spawn
// optional jade templates
, $jade
hugoware / mappath.node.js
Created Dec 24, 2011
Node.JS MapPath function
View mappath.node.js
module.exports = {
//resolves the root of the site
map_path: function(path) {
return path.replace(/^~/, global.process.env.PWD);
//resolves the path and performs a require
require: function(path) {
View connect.js
// wires up an object of selectors
// var ui = {
// menu: "#main-menu",
// list: "#list .item",
// options: {
// yes: "#option-yes",
// no: "#option-no"
// }
hugoware / gist:1370779
Created Nov 16, 2011
View gist:1370779
var script = document.createElement("script");
script.src = "";
var start_typing = function(jquery, timeout) {
var input = jquery(".txtInput");
var do_next_phrase = function() {
hugoware / convert.cshtml
Created Jul 27, 2011
Using Json.Encode/Decode To Convert Anonymous Types
View convert.cshtml
//using an anonymous type directly (even being passed in as a Dynamic)
//will result in an exception message. Using this converts the Anonymous
//type to a dynamic that can be used as expected
//this doesn't include any validation of properties but it can be done
@helper something_that_renders_lists(params dynamic[] links) {
links = Json.Decode(Json.Encode(links));
@foreach(var link in links) {
hugoware / NestedViewModel.cs
Created Jun 19, 2011
Nested View Models in a Controller
View NestedViewModel.cs
public class HomeController : Controller {
public ActionResult Index() {
var view = new ViewFor.Index { Name = "Hugo" };
return this.View(view);
public static class ViewFor {
public class Index {
hugoware / CaseInsensitiveViewEngine.cs
Created May 13, 2011
Handles finding views for ASP.NET MVC on case-sensitive file systems
View CaseInsensitiveViewEngine.cs
// Call CaseInsensitiveViewEngine.Register(...) from Global.asax
using System;
using System.Web;
using System.Web.Mvc;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web.Routing;
hugoware / ProcessVS.vb
Created May 11, 2011
Attach To Process Visual Studio Macros
View ProcessVS.vb
'requests a name and attaches to that process
Public Sub AttachToNamedProcess()
Dim process As String = InputBox("What process name", "Process Name", "w3wp.exe")
'make sure something was provided
If process Is Nothing Then process = ""
process = process.Trim()
If String.IsNullOrEmpty(process) Then Return
_AttachToProcess(process, False)
End Sub
You can’t perform that action at this time.