Skip to content

Instantly share code, notes, and snippets.

View tonidy's full-sized avatar

toni dy tonidy

View GitHub Profile
@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {
@mnowakowski
mnowakowski / jQuery validation message
Created January 21, 2011 10:47
Custom message in addMethod for jQuery validation
$j.validator.addMethod("remote_data", function(value, element, params) {
var my_message = "some message";
$j.ajax({
...
});
if (correct){
return true;
} else {
$j.validator.messages.remote_data = my_message;
return false;
@davidfowl
davidfowl / Examples
Created May 21, 2011 08:19
Powershell function that recursively walks all project items within a project and lets you execute an action on each one
# Print all project items
Recurse-Project -Action {param($item) "`"$($item.ProjectItem.Name)`" is a $($item.Type)" }
# Function to format all documents based on https://gist.github.com/984353
function Format-Document {
param(
[parameter(ValueFromPipelineByPropertyName = $true)]
[string[]]$ProjectName
)
Process {
@pksunkara
pksunkara / config
Last active April 20, 2024 04:50
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[init]
defaultBranch = master
[core]
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
namespace.views.MyWizard = Backbone.Views.extend({
initialize: function() {
_.bindAll(this, 'render', 'wizardMethod');
}
render: function() {
this.wizardMethod();
return this;
},
@fschwiet
fschwiet / gist:1302170
Created October 20, 2011 20:01
install IIS via powershell
#
# http://technet.microsoft.com/en-us/library/cc722041%28v=WS.10%29.aspx
#
# Feature names are case-sensitive, and you will get no warnings if you mispell a feature or
# do not include prerequisite features first. Proceed with care.
#
function InstallFeature($name) {
cmd /c "ocsetup $name /passive"
@robcowie
robcowie / rabbitmq_conf_homebrew
Created October 26, 2011 19:48
Location of rabbitmq config files with homebrew
Rabbitmq conf locations for homebrew
/usr/local/etc/rabbitmq/rabbitmq-env.conf
/usr/local/etc/rabbitmq/rabbitmq
@kamranayub
kamranayub / Transforms.xml
Created February 26, 2012 18:02
MSBuild Inline Task to Transform a Hierarchy of XML Files using XDT Transforms
<!-- This task takes in a XDT transform file and transforms it, following any inheritance chain.
There should be at least one base transform for this to work; otherwise just use Microsoft's
regular TransformXml task. -->
<!-- EXAMPLE USAGE:
<TransformXmlHierarchy
Source="source.xml"
Destination="transformed.xml"
TaskDirectory="path/to/directory/of/Microsoft.Web.Publishing.Tasks" />
-->
<UsingTask

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@clupasq
clupasq / nlog colored console files
Created March 13, 2012 08:52
nlog configuration for colored console + info&error files
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="coloredConsole" xsi:type="ColoredConsole" useDefaultRowHighlightingRules="false"
layout="${longdate}|${pad:padding=5:inner=${level:uppercase=true}}|${message}" >
<highlight-row condition="level == LogLevel.Debug" foregroundColor="DarkGray" />
<highlight-row condition="level == LogLevel.Info" foregroundColor="Gray" />
<highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" />