Skip to content

Instantly share code, notes, and snippets.

View kitmenke's full-sized avatar

Kit Menke kitmenke

View GitHub Profile
# Source: https://coderwall.com/p/euwpig/a-better-git-log
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
# Source: http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
git config --global alias.ll "log --pretty=format:\"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]\" --decorate --numstat"
git config --global alias.s "status --short"
@kitmenke
kitmenke / .vimrc
Last active March 23, 2018 14:04
Linux server setup for vim with python
call plug#begin('~/.vim/plugged')
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'terryma/vim-multiple-cursors'
" Plug 'davidhalter/jedi-vim'
" Plug 'nvie/vim-flake8'
call plug#end()
" indent using four spaces
set expandtab
set tabstop=4
@kitmenke
kitmenke / changeSubscriptionOwner.ps1
Created November 25, 2014 19:04
Powershell script to change the owner of a subscription to another user
Write-Host '*************************************'
Write-Host 'Change Subscription Owner starting...'
Write-Host '*************************************'
$oldOwner = "domain\user1"
Write-Host "Old Owner = $oldOwner"
$newOwner = "domain\user2"
Write-Host "New Owner = $newOwner"
$itemPathOrSiteURL = "http://servername/sites/subsite"
Write-Host "Item Path or Site URL = $itemPathOrSiteURL"
$reportServerUri = "http://servername/_vti_bin/ReportServer/ReportService2010.asmx?wsdl"
@kitmenke
kitmenke / setfromurl.html
Last active September 24, 2015 02:48
Auto-populate a SharePoint field using a URL Parameter
<script src="/kitsite/Files/jquery-1.11.0.min.js"></script>
<script src="/kitsite/Files/sputility.min.js"></script>
<script>
// url parsing from http://stackoverflow.com/a/2880929/98933
var urlParams;
(window.onpopstate = function () {
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
@kitmenke
kitmenke / gist:9782966
Created March 26, 2014 13:20
Update a report's shared data source
string itemPath = "http://servername/sites/reporting/Report Library/My_Report.rdl";
string dataSourceName = "Datasource1";
DataSource[] dsarray = new DataSource[1];
DataSourceReference reference = new DataSourceReference();
reference.Reference = "http://servername/sites/reporting/Data Sources/DATA_SOURCE_NET.rsds";
dsarray[0] = new DataSource();
dsarray[0].Name = dataSourceName;
dsarray[0].Item = reference;
@kitmenke
kitmenke / sp2013ajax.js
Created November 24, 2013 16:08
Example for making an AJAX call against SharePoint 2013's REST API using jQuery
$.ajax({
dataType: "json",
accepts: { "json":"application/json;odata=verbose"},
url: "/timetracking/_api/web/lists/getByTitle('Timesheet Entries')/items"
});
@kitmenke
kitmenke / client.go
Last active December 28, 2015 22:59
TCP client and server written in Go
package main
import (
"bytes"
"flag"
"fmt"
"math/rand"
"os"
"time"
"net"
@kitmenke
kitmenke / multiemail.js
Created November 5, 2013 22:07
Knockout Validation multiple email address
ko.validation.rules['multiemail'] = {
validator: function (val, validate) {
if (!validate) { return true; }
var isValid = true;
if (!ko.validation.utils.isEmptyVal(val)) {
// use the required: true property if you don't want to accept empty values
var values = val.split(';');
$(values).each(function (index) {
isValid = ko.validation.rules['email'].validator($.trim(this), validate);
@kitmenke
kitmenke / getcurrentuser.html
Created November 1, 2013 02:57
An example of getting the current user via SharePoint's client object model
<script type="text/javascript">
function CustomExecuteFunction() {
var self = this;
self.context = new SP.ClientContext.get_current();
self.web = context.get_web();
self.currentUser = web.get_currentUser();
context.load(self.currentUser);
self.asyncSuccess = function(sender, args) {
var user = this.currentUser;
@kitmenke
kitmenke / WebForm1.aspx.cs
Created August 27, 2013 18:31
Example for calling the Microsoft Translator AJAX API using jQuery
private static AdmAuthentication _admAuth = new AdmAuthentication(AdmConstants.CLIENT_ID, AdmConstants.CLIENT_SECRET);
protected void Page_Load(object sender, EventArgs e)
{
txtAuthToken.Text = _admAuth.GetAccessToken().access_token;
txtAuthExpires.Text = _admAuth.GetAccessToken().expires_in;
}