Skip to content

Instantly share code, notes, and snippets.

View Watson1978's full-sized avatar

Watson Watson1978

View GitHub Profile
// Add URL into safari's reading list
//
// Usage:
// swift readlinglist.swift http://apple.com
//
import Cocoa
class AppDelegate: NSObject, NSApplicationDelegate, NSSharingServiceDelegate {
func add(URL url : String) {
let service = NSSharingService(named: NSSharingServiceNameAddToSafariReadingList)!

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

#include <stdlib.h>
#include <stdio.h>
void
copy_unrolling(const char* src, short* dst, int n)
{
int i = n;
while ((i - 4) >= 0) {
*dst++ = *src++; *dst++ = *src++;
*dst++ = *src++; *dst++ = *src++;
# X11
http://xquartz.macosforge.org/landing/
XQuartz-2.7.4.dmg
# "brew install gtk+3" でインストールされたもの
glib-2.34.3.tar.xz
jpeg-8d.mountainlion.bottle.tar.gz
tiff-4.0.3.tar.gz
gdk-pixbuf-2.26.2.tar.xz
freetype-2.4.10.mountainlion.bottle.tar.gz
#!/usr/sbin/dtrace -s
#pragma D option quiet
BEGIN
{
printf("Target pid: %d\n\n", $target);
}
macruby$target:::method-entry
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
srand(time(NULL));
printf("rand = %d", rand() % 7);
}
require 'mobiruby'
#require 'hello'
#require 'samegame_app'
def fib(n)
return 0 if n <= 0
return 1 if n == 1
return fib(n - 2) + fib(n - 1)
end
/*
Do not change this file.
Generated from BridgeSupport.
*/
#include "cocoa.h"
#import "QuartzCore/CAAnimation.h"
#import "QuartzCore/CABase.h"
#import "QuartzCore/CADisplayLink.h"
#import "QuartzCore/CAEAGLLayer.h"
#import "QuartzCore/CAEmitterCell.h"
/*
Do not change this file.
Generated from BridgeSupport.
*/
#include "cocoa.h"
#import "QuartzCore/CAAnimation.h"
#import "QuartzCore/CABase.h"
#import "QuartzCore/CADisplayLink.h"
#import "QuartzCore/CAEAGLLayer.h"
#import "QuartzCore/CAEmitterCell.h"
@Watson1978
Watson1978 / AppDelegate.rb
Created July 27, 2012 02:47
MacRuby : NSSharingService
#
# AppDelegate.rb
# tweet
#
# Created by watson on 2012/07/27.
#
class AppDelegate
attr_accessor :window
def applicationDidFinishLaunching(a_notification)