Skip to content

Instantly share code, notes, and snippets.

View chrismcg's full-sized avatar

Chris McGrath chrismcg

View GitHub Profile
/* Ruby Thread support:
Ruby implements threads by using setjmp/longjmp to switch between separate
C stacks within one native thread.
This confuses Objective C because NSThread stores a per-native-thread stack
of autorelease pools and exception handlers. When the C stack changes, an
error message like this is likely to appear:
Exception handlers were not properly removed. Some code has jumped or
#!/usr/bin/ruby
require 'osx/cocoa'
include OSX
class Foo < NSObject
def applicationDidFinishLaunching(sender)
puts "yo"
end
end
@chrismcg
chrismcg / gist:9984897345b846c58d35
Created July 4, 2015 15:20
Patch for How to get ES6 source of phoenix.js into an ember-cli app
diff --git a/Brocfile.js b/Brocfile.js
index 7fa2af9..3718742 100644
--- a/Brocfile.js
+++ b/Brocfile.js
@@ -1,6 +1,9 @@
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
+var ES6Modules = require('broccoli-es6modules');
+var esTranspiler = require('broccoli-babel-transpiler');
defmodule AuthController do
# ...
def index(conn, _params) do
#...
twitter_client(conn).do_something
#...
end
# Allow replacing the module used to call twitter. This is used in tests to
# stub out the external service
defmodule Sheep.PageController do
use Sheep.Web, :controller
alias Sheep.Repo
alias Sheep.MailingListAddress
def index(conn, _params) do
render conn, "index.html"
end
def new_email(conn, params) do
defmodule Sheep.PageController do
use Sheep.Web, :controller
alias Sheep.Repo
alias Sheep.MailingListAddress
def index(conn, _params) do
render conn, "index.html"
end
def new_email(conn, params) do
# in ~/.irbrc
if ENV['RAILS_ENV']
load '~/.railsrc'
end
# in ~/.railsrc
def sql(query)
ActiveRecord::Base.connection.select_all(query)
end
export LSCOLORS=gxfxcxdxbxegedabagacad
if [[ $OS == 'Linux' ]]; then
alias ls='ls --color=auto'
else
alias ls='ls -G'
fi
alias ll='ls -l'
alias lls='ll -S'
alias lt='ll -t'
alias ltr='ls -ltr'
#!/usr/bin/env ruby -w
#---
# Excerpted from "TextMate"
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/textmate for more book information.
#---
$LOAD_PATH << "#{ENV["TM_SUPPORT_PATH"]}/lib"
require "exit_codes"
require "web_preview"