Skip to content

Instantly share code, notes, and snippets.

Pod::Spec.new do |s|
s.name = "CocoaScript"
s.version = "1.0"
s.summary = "CocoaScript is a scripting language for Mac OS X built on top of JavaScript, with a bridge to Apple's Cocoa libraries. You can use it to communicate with other applications just like AppleScript does."
s.homepage = "http://jstalk.org"
s.license = "MIT"
s.author = {"Gus Mueller" => "gus@flyingmeat.com"}
s.source = {:git => "http://github.com/ccgus/cocoascript.git"}
s.source_files = "src/framework/**/*.{h,m}"
s.prefix_header_file = 'src/framework/CocoaScript_Prefix.pch'

Keybase proof

I hereby claim:

  • I am bosmacs on github.
  • I am bosmacs (https://keybase.io/bosmacs) on keybase.
  • I have a public key whose fingerprint is 5B71 EF92 7991 D15E E420 0E0C 0428 5F56 C4FC BAA5

To claim this, I am signing this object:

@bosmacs
bosmacs / instrumented.cpp
Created February 25, 2015 14:05
Instrumented type
#include "instrumented.hpp"
// necessary static initialization -- this needs to be done for each type we want to instrument
template<> size_t instrumented<short>::comparison_count = 0;
template<> size_t instrumented<int>::comparison_count = 0;
template<> size_t instrumented<float>::comparison_count = 0;
template<> size_t instrumented<double>::comparison_count = 0;
# add list comprehensions to arrays, used like so:
# >> (1..25).to_a.comprehend { |x| x**2 if not x % 2 == 0 }
# => [1, 9, 25, 49, 81, 121, 169, 225, 289, 361, 441, 529, 625]
class Array
def comprehend(&block)
block ? map(&block).compact : self
end
end
uniform sampler2D tex0;
uniform sampler2D tex1;
void main()
{
vec4 t0 = texture2D(tex0, gl_TexCoord[0].st);
vec4 t1 = texture2D(tex1, gl_TexCoord[0].st);
gl_FragColor = (1.0 - t1.a) * t0 + t1.a * t1;
}
import urlgrabber
import urlgrabber.progress
u = urlgrabber.grabber.URLGrabber()
u.urlgrab('http://pypi.python.org/packages/source/u/urlgrabber/urlgrabber-3.1.0.tar.gz', progress_obj=urlgrabber.progress.TextMeter())
/*
© 2010 Jens Ayton
This code may be used freely.
*/
uniform float uValue; // Value/brighness component.
const float kPi = 3.141592653589793;
tell application "Safari"
set _source to do JavaScript "window.document.documentElement.outerHTML" in document 1
set _name to name of document 1
end tell
tell application "BBEdit"
make new text window with properties ¬
{contents:_source, source language:"HTML", name:"Generated source: " & _name}
select insertion point before character 1 of text window 1
@bosmacs
bosmacs / gist:1065098
Created July 5, 2011 15:47 — forked from gruber/gist:1063605
Simple Inbox Archiving Script for Apple Mail
-- See article here: http://daringfireball.net/2007/07/simple_inbox_sweeper
-- The following should be one long line:
set _description to "All unflagged, read messages in each IMAP account
inbox will be moved to the “Archive” mailbox corresponding to that
account. This action is not undoable."
tell application "Mail"
display alert "Archive read messages from IMAP inboxes?" buttons ¬
{"Cancel", "Archive"} cancel button 1 message _description
@bosmacs
bosmacs / gist:1223228
Created September 16, 2011 21:40
OpenCTM Brewfile
require 'formula'
class Openctm < Formula
url 'http://downloads.sourceforge.net/project/openctm/OpenCTM-1.0.3/OpenCTM-1.0.3-src.tar.bz2'
homepage 'http://openctm.sourceforge.net/'
md5 '55948e7c2ad8c5807cd1b9b48718075b'
def install
inreplace ["Makefile.macosx"] do |s|
s.gsub! "/usr/local", prefix