Skip to content

Instantly share code, notes, and snippets.

import Cocoa
import MASShortcut
func pow() {
let rect = NSScreen.mainScreen()?.frame
let window = NSWindow(contentRect: rect!, styleMask: NSBorderlessWindowMask, backing: .Buffered, `defer`: false)
window.backgroundColor = NSColor.clearColor()
window.opaque = false
window.alphaValue = 1
window.makeKeyAndOrderFront(NSApplication.sharedApplication())
@staltz
staltz / introrx.md
Last active June 15, 2024 12:24
The introduction to Reactive Programming you've been missing
@swizzlr
swizzlr / blockdeclsyntax.md
Created August 19, 2013 13:11
Block Declaration Syntax List, originally by [pcperini](http://stackoverflow.com/a/9201774/929581), parsed to markdown for printing with your favourite CSS (I recommend @ttscoff's Marked)

List of Block Declaration Syntaxes

Throughout, let

  • return_type be the type of object/primitive/etc. you'd like to return (commonly void)
  • blockName be the variable name of the block you're creating
  • var_type be the type object/primitive/etc. you'd like to pass as an argument (leave blank for no parameters)
  • varName be the variable name of the given parameter And remember that you can create as many parameters as you'd like.

Blocks as Variables

Possibly the most common for of declaration.

@osdrv
osdrv / mercator.cpp
Created December 30, 2011 08:38
c++ libcinder mercator coordinates mapper
#include "Mercator.h"
#include "cinder/app/AppBasic.h"
#include "cinder/Vector.h"
using namespace ci;
using namespace std;
/* static method to map latitude and longitude to mercator 2d coords */
Vec2f Mercator::mapLatLon( const Vec2f lat_lon ) {
/* mercator projection center was screen centered */
Vec2f offset = Vec2f( app::getWindowWidth() / 2, app::getWindowHeight() / 2 );