Skip to content

Instantly share code, notes, and snippets.

View johanoloflindberg's full-sized avatar
💭
Ready to work 😃

WEBBAB johanoloflindberg

💭
Ready to work 😃
View GitHub Profile
@johanoloflindberg
johanoloflindberg / fluid_gmail.js
Created November 21, 2016 03:59 — forked from kevshub/fluid_gmail.js
- Removed duplicate timers - Added a remove badge option - Added (Advanced) Growl Notifications, # of new emails and # of unread messages. - Only notify when email counter goes up not down - Added sound notification
window.fluid.dockBadge = '';
function updateDockBadge() {
console.log('check new messages');
var navigation = document.querySelector('[role=navigation]')
var doc = navigation.contentDocument || navigation.ownerDocument;
if (!doc) { return; }
@johanoloflindberg
johanoloflindberg / Command-line.md
Created November 21, 2016 03:58 — forked from NickChristensen/Command-line.md
A few notes and links from the Lunch & Learn
@johanoloflindberg
johanoloflindberg / gmail-inbox-count-terse.js
Created November 21, 2016 03:57 — forked from NickChristensen/gmail-inbox-count-terse.js
Userscript for http://fluidapp.com: Sets dock badge to inbox count
window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 1000);
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 5000);
function updateDockBadge() {
window.fluid.dockBadge = document.querySelector('[title^="Inbox"]').title.match(/\d+/);
}
The initial Fluidium 0.1 release is based on the browser code powering both Fluid SSBs and Cruz (www.fluidapp.com, www.cruzapp.com).
Almost all of the code included in this project was updated prior to this release, and some of it was rewritten completely. Most of the rewriting was done due to messiness/poor architecture in the old codebase, and because I've learned a lot while writing and maintaining a Cocoa browser codebase over the past two years.
Stuff that was completely rewritten (and therefore may not be well-tested yet):
- FUDocumentController/FUDocument/FUWindowController/FUTabController/FUWindow : this is the code which handles basic browser window/tab management, and is the core functionality of the browser. It conforms to the Cocoa Document-based application design pattern.
- Userscripting : previously, Fluid and Cruz userscripting was based on GreaseKit. That has been removed and replaced with a new implementation in Fluidium.
@johanoloflindberg
johanoloflindberg / pdfmultipage.m
Created November 21, 2016 03:56 — forked from itod/pdfmultipage.m
PDF Rendering white background
- (NSData *)PDFDataForMultiPageDocument {
NSMutableData *data = [NSMutableData data];
CGDataConsumerRef consumer = CGDataConsumerCreateWithCFData((CFMutableDataRef)data);
if (NULL == consumer) {
NSLog(@"could not create consumer");
return nil;
}
CGRect r = CGRectMake(0.0, 0.0, 800.0, 600.0);;
@johanoloflindberg
johanoloflindberg / remove_prefix.applescript
Created November 21, 2016 03:56 — forked from itod/remove_prefix.applescript
AppleScript to remove a common prefix from the name of all files in a given folder.
set path_ to (get path to desktop as string) & "FOLDER NAME HERE"
set prefix_ to "PREFIX HERE"
tell application "Finder"
set dir_ to folder path_
set files_ to items of dir_ whose name of it starts with prefix_
set start_ to (get length of prefix_) + 1
repeat with file_ in files_
set oldname_ to name of file_
set end_ to length of oldname_
@johanoloflindberg
johanoloflindberg / rename_retina.applescript
Created November 21, 2016 03:56 — forked from itod/rename_retina.applescript
Rename 2x images to "@2x" and move them to a parallel folder structure of 1x images
set doubleDirPath_ to "path to 2x images"
set singleDirPath_ to "path to 1x images" -- also destination path
set ext_ to ".png"
set extLen_ to length of ext_
set suffix_ to "@2x"
tell application "Finder"
set doubleDir_ to folder doubleDirPath_
set singleDir_ to folder singleDirPath_
set dirs_ to (get every item of doubleDir_)
@johanoloflindberg
johanoloflindberg / extract_iphoto_originals.applescript
Created November 21, 2016 03:56 — forked from itod/extract_iphoto_originals.applescript
Recursively extract Original photos from an iPhoto library
set _srcPath to ((get path to desktop) & "Backup:Pictures" as string)
set _destPath to ((get path to desktop) & "Out" as string)
on processDir(_parent)
tell application "Finder"
set _parentName to (get name of _parent as string)
set _kids to (get every item of _parent whose name is not ".")
if "Thumbs" is equal to _parentName then
return
else if "Originals" is equal to _parentName then
@johanoloflindberg
johanoloflindberg / gist:fc23a99982bbbfb1e5e13e1cb961afde
Created November 21, 2016 03:15 — forked from itod/gist:ae269e123cf94e42ccff
Try/finally cleaner than multiple gotos with label?
void myfunc() {
void *thing1 = NULL;
void *thing2 = NULL;
@try {
thing1 = allocThing1();
if (!thing1) return;
// …use thing1 maybe
@johanoloflindberg
johanoloflindberg / tryfinally
Created November 21, 2016 03:15 — forked from itod/tryfinally
Try/Finally with no exceptions in sight.
//
// main.m
// Finally
//
// Created by Todd Ditchendorf on 6/19/15.
// Copyright (c) 2015 Todd Ditchendorf. All rights reserved.
//
#import <Foundation/Foundation.h>