Skip to content

Instantly share code, notes, and snippets.

View mipmip's full-sized avatar
🐟

Pim Snel mipmip

🐟
View GitHub Profile
@mipmip
mipmip / images_to_word_with_headings.scpt
Created December 7, 2016 20:51
Insert Images in Word Document adds image title as heading inserts a page break
on basename(thePath) -- Requires POSIX path
if thePath ends with "/" then
set nameIndex to -2
else
set nameIndex to -1
end if
set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to "/"
set thePath to text item nameIndex of thePath
set AppleScript's text item delimiters to ASTID
@mipmip
mipmip / quick_and_dirty_logging.php
Created February 16, 2012 12:12
Quick and dirty logging in PHP
<?php
function log($msg)
{
//using the date() function
$time = date("F jS Y, h:iA");
//$remote_addr is PHP variable to get ip address
$ip = $REMOTE_ADDR;
@mipmip
mipmip / convert vimbuffer with Markdown to word
Last active November 24, 2016 10:52
Write and convert vim buffer with markdown content to Word doc.
map <silent> ,w :silent w<CR> :!pandoc '%' -o '%.docx'<CR><CR>
@mipmip
mipmip / fugitive.workflow.vim
Last active October 5, 2016 10:19
functions for fast single file vim/fugitive workflow
" Functions for fast single file vim/fugitive workflow
"
" Add this in your .vimrc and use it like this:
" Just commit current file with message
" :GitCommitWithMessage 'fix typo'
" Commit current file with message and push afterwards
" :GitCommitPushWithMessage 'fix typo'
@mipmip
mipmip / Document.mustache
Created January 7, 2016 17:30
RubyMotion & GRMustache Trivial Example
{{ name }}
{{{ name }}}
@mipmip
mipmip / gist:6410695
Created September 2, 2013 08:49
truncate a sqlite3 table in cli (refx)
sqlite3 refx3development.sqlite3
sqlite3> .table
sqlite3> DELETE FROM jobs;
sqlitw3> .quit
@mipmip
mipmip / kickstarter_bybass
Created July 12, 2013 15:11
Bypass for: kickstarter doesn't want to save because MD5 value in invalid.
// Write files:
foreach($writeFiles as
$theFile => $fileData) {
t3lib_div::writeFile($extDirPath.$theFile,$fileData['content']);
if
(!@is_file($extDirPath.$theFile)) {
$content .=
sprintf($GLOBALS['LANG']->getLL('ext_import_file_not_created'),
$extDirPath .
@mipmip
mipmip / InDesignIntrospection.rb
Created July 11, 2013 13:39
InDesign Object Introspection
require 'osx/cocoa'
require 'rubygems'
require 'appscript'
require 'activesupport'
require 'base64'
require 'fileutils'
class InDesignTrospection
include Appscript
@mipmip
mipmip / referencePoint.rb
Created July 11, 2013 12:40
set indesign reference point
require 'rubygems'
require 'appscript'
include Appscript
idApp = app('Adobe InDesign CS4')
myDoc= idApp.make(:new => :document)
p idApp.layout_windows[1].transform_reference_point.set(:to=> :top_left_anchor)
@mipmip
mipmip / printImageTypeAndFilePath.appscript.rb
Created July 11, 2013 12:39
print Image Type And FilePath
require 'rubygems'
require 'appscript'
include Appscript
outputDir= File.join(ENV['HOME'],'Desktop')
pdfpath = File.join(outputDir, "myTempFile.pdf")
filepath = File.join(outputDir, "myTempFile.indd")
imagepath = File.join(outputDir, "Schermafbeelding.png")
imagepath = File.join(outputDir, "Schermafbeelding.png")
imagepath = File.join(outputDir, "test.psd")