This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var real_docwrite = document.write, | |
body = $('body'); | |
(function insertGists(a_tags) { | |
if (a_tags.length > 0) { | |
a_tag = a_tags.shift() | |
document.write = function(stylesheet) { | |
$('head').append(stylesheet); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def episode(dir) | |
dir.match "HDTV" | |
end | |
def unrar_delete(thefile,allfiles) | |
if system "/opt/local/bin/unrar e -y %s > /dev/null" % thefile.gsub(' ',' ') | |
for file in allfiles | |
File.delete(file) | |
end | |
return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Finder" | |
set the theFolder to choose folder with | |
"Pick a folder containing the OmniGraffle files you want to export to PDF:" | |
set theList to every file of the theFolder whose | |
name extension is "graffle" | |
end tell | |
repeat with theFile in theList | |
set theOutFile to ((do shell script "basename \"" & (theFile) & "\"" & " .graffle") & ".pdf") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
require 'sqlite3' | |
require 'iconv' | |
require 'HTMLEntities.rb' | |
class String | |
def to_iso |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app <- function(env){ | |
req <- Rook::Request$new(env) | |
res <- Rook::Response$new() | |
inputData <- gsub("##","\n",req$POST()[['data']]) | |
write(inputData, file = "inputData.txt") | |
d <- read.table( "inputData.txt", sep=",", header=TRUE, row.names=1 ) | |
d.startY <- as.integer( substr( row.names(d)[1], 1, 4 ) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'win32ole' | |
require 'CSV' | |
outlook = WIN32OLE.new('Outlook.Application') | |
m = outlook.GetNameSpace('MAPI') | |
def searchfolder(folder) | |
return if folder.defaultitemtype > 0 #only email folders | |
return if ["Deleted Items","Sync Issues","News Feed","RSS Feeds","Junk E-mail","SharePoint Lists"].member? folder.name | |
folderpath = folder.fullfolderpath.gsub("\\","-").gsub("--","") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, os.path, re | |
import httplib2 | |
from email.Header import decode_header | |
from apiclient.discovery import build | |
from oauth2client.client import flow_from_clientsecrets | |
from oauth2client.file import Storage | |
from oauth2client.tools import run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple cheat sheet of Spark Dataframe syntax | |
# Current for Spark 1.6.1 | |
# import statements | |
from pyspark.sql import SQLContext | |
from pyspark.sql.types import * | |
from pyspark.sql.functions import * | |
#creating dataframes | |
df = sqlContext.createDataFrame([(1, 4), (2, 5), (3, 6)], ["A", "B"]) # from manual data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enabledelayedexpansion | |
REM Get the chosen branch as a variable (Default: current branch) | |
if [%2%]==[] ( | |
git rev-parse --abbrev-ref HEAD > tmpFile | |
set /p git_branch=<tmpFile | |
del tmpFile | |
) else ( | |
set git_branch=%2 |