Skip to content

Instantly share code, notes, and snippets.

View MRdNk's full-sized avatar

Duncan Angus Wilkie MRdNk

View GitHub Profile
@MRdNk
MRdNk / Graph.js
Last active December 12, 2015 12:38
Example of using gRaphael for a simple graph
$(function () {
var r = Raphael("example");
var chart = r.g.linechart (
10, 10,
490, 180,
[
[1,2,3,4,5,6,7],
[3.5,4.5,5.5,6.5,7,8]
],
[

Copy from vim to System Clipboard

:4,8!pbcopy "Copy line 4 to 8
@MRdNk
MRdNk / Readme.md
Last active December 14, 2015 05:48
Useful TotalMonths calculation, that extends the DateTime type.
@MRdNk
MRdNk / IDENTITY_INSERT.sql
Created March 6, 2013 09:24
IDENTITY_INSERT example
-- SET IDENTITY_INSERT to ON.
SET IDENTITY_INSERT products ON
GO
-- Attempt to insert an explicit ID value of 3
INSERT INTO products (id, product) VALUES(3, 'garden shovel').
GO
SET IDENTITY_INSERT products OFF

URL: https://bugzilla.mozilla.org/show_bug.cgi?id=779297

Error:

Bugzilla has suffered an internal error

Can't connect to the database.
Error: Can't connect to MySQL server on 'db-bugs-rw' (113)
  Is your database installed and up and running?
 Do you have the correct username and password selected in localconfig?

This is a short hand...

$(function () {

});

For this...

@MRdNk
MRdNk / datepicker.setDefaults.js
Created March 20, 2013 19:12
JQuery UI DatePicker SetDefaults
(function ($) {
$.datepicker.setDefaults({
regional: 'en-GB',
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true,
minDate: new Date(),
yearRange: '1900:c'
});
})(jQuery);
@MRdNk
MRdNk / UsingTedious.js
Created May 13, 2013 21:11
Basic Setup for using Tedious (TDS) in node.js
var Connection = require('tedious').Connection
var Request = require('tedious').Request
var TYPES = require('tedious').TYPES
var config = {
userName: 'Username'
, password: 'password'
, server: 'localhost'
}
@MRdNk
MRdNk / WebRequest.cs
Created May 22, 2013 07:05
WebRequest C# Guide
// Guide http://msdn.microsoft.com/en-us/library/debx8sh9.aspx
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Examples.System.Net
{
public class WebRequestPostExample
user=`whoami`
# if installing node directly
sudo chown -R $user /usr/local/bin
sudo chown -R $user /usr/local/lib/node_modules
# if using nvm
sudo chown -R $user ~/.npm