Skip to content

Instantly share code, notes, and snippets.

View timhobbs's full-sized avatar

Tim Hobbs timhobbs

View GitHub Profile
@timhobbs
timhobbs / gist:4d2751b1cbe6d9498692465a40cc9c77
Created March 13, 2019 17:35 — forked from vladimirtsyupko/gist:10964772
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@timhobbs
timhobbs / git-tag-delete-local-and-remote.sh
Created March 13, 2019 17:35 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@timhobbs
timhobbs / camelCase.js
Created June 6, 2018 04:05 — forked from johnsmith17th/camelCase.js
To convert string to camel case in javascript.
function toCamelCase(string) {
string = string.toLowerCase().replace(/(?:(^.)|([-_\s]+.))/g, function(match) {
return match.charAt(match.length-1).toUpperCase();
});
return string.charAt(0).toLowerCase() + string.substring(1);
}
@timhobbs
timhobbs / sandbox.js
Created June 3, 2015 18:44
Javascript sandbox
/**
* Just playing around with Function.prototype.call
* jsfiddle: https://jsfiddle.net/jesus_tesh/e7ufpLmz/
**/
console.clear();
console.log("Basic function call");
console.log("===================\n");
@timhobbs
timhobbs / gist:bb8a304a8d008d74fd29
Last active November 30, 2018 02:37
C# style String.Format for JS
/* Examples:
* var test = "test {0} {1}, {2} - {0} {1} {2}".format('a', 'b', 'c');
* var test2 = "the {0} ate the {1}".format("cat", "canary");
*/
String.prototype.format = function () {
var self = this;
var re = /\{\d+\}/g;
var m = self.match(re);
var indexes = [];
@timhobbs
timhobbs / gist:396310147fffbf8dc8d0
Created May 12, 2015 17:48
Angular controller communication via service
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" ng-app="app">
<head>
<title>Demo</title>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>Demo</h1>
<div class="row">
<!DOCTYPE html>
<html ng-app="app">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Demo</title>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
<style>
body { font-family: Calibri }
.form-horizontal .checkbox label {
@import "variables.less";
@import "mixins.less";
@import "buttons.less";
@import "modals.less";
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:10001; overflow:hidden;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative;}
#cboxLoadedContent{overflow:auto;}
cinst fiddler4
cinst console-devel
cinst sublimetext2
cinst googlechrome
cinst windirstat
cinst sysinternals
cinst 7zip
cinst winmerge
cinst firefox
cinst nodejs
namespace MySweetApp
{
using System;
using System.Linq.Expressions;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;
public static class FormHelpers