Skip to content

Instantly share code, notes, and snippets.

@erica
erica / gist:0c445044e1bf97778263
Last active February 19, 2020 13:32
#swift-lang ReadMe

"JUST BECAUSE YOU'RE USING SWIFT DOESN'T MEAN YOUR QUESTION IS ABOUT SWIFT"

How To Get Answers

Ask your question and then be patient. Tell us what you want to happen, what is actually happening, and include any error messages you find:

  • Provide a scenario. "I am trying to do X, I do so by calling APIs W and Y, but Z happens instead. I see the following error messages:..."
  • Focus on the goal. Ask about what you're trying to achieve (the big story) rather than the specific technical detail that you believe is holding you back.
  • Don't solicit help. Don't say, "Does anyone here know about (for example) Protocol Extensions". Just ask your question.
  • Do your homework. Search the web before asking in-channel.
  • Be courteous Don't just paste Stack Overflow questions in-channel.
  • Remember the topic Refer questions about third party libraries to their developers.
@srid
srid / gist:2151665
Created March 21, 2012 19:23
building doozerd and doozer
# install go weekly to ~/go
cd
hg clone https://go.googlecode.com/hg/ go
hg up weekly
cd src && ./make.bash
export PATH=~/go/bin:$PATH
export GOROOT=~/go
# doozer client
cd $GOROOT/src/pkg/github.com/ha/
@jefftrull
jefftrull / main.cpp
Created January 9, 2012 09:53
Example of producer-consumer for Ruby interpreter with separate thread in C++
// Example of running Ruby in a separate thread
// 2012-01-08 by Jeff Trull <[email protected]>
#include <iostream>
#include <queue>
#include <string>
#include <set>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
@seanlilmateus
seanlilmateus / filesystem_events.rb
Created October 10, 2011 18:53
Handling Filesystem Events with GCD and Macruby
#!/usr/local/bin/macruby
framework 'Foundation'
include Dispatch
#``O_EVTONLY`` is defined as ``0x8000`` in the OS X header files.
# instead of RDONLY flag I use the O_EVTONLY flag to open() the file, otherwise we'll prevent the
# volume that the file is on from being unmounted.
O_EVTONLY = 0x8000
@nolanw
nolanw / fscript.rb
Last active September 26, 2015 22:38
Inject F-Script into any app on OS X 10.7 or 10.8. (Yet another F-Script Anywhere replacement.)
#!/usr/bin/env ruby
FSCRIPT_PATH = "/Library/Frameworks/FScript.framework"
if ARGV.empty?
puts "Usage: #{$0} process_name"
exit
end
GDB = IO.popen("gdb", 'w')
require "ffi"
class ULLEnum < FFI::Enum
def native_type
FFI::Type::ULONG_LONG
end
end
class MachMsgHeader < FFI::Struct
layout :bits, :uint, :size, :uint, :remote_port, :uint, :local_port, :uint, :reserved, :uint, :id, :int
@guybrush
guybrush / nodeconf_2011.md
Created May 6, 2011 07:22
a list of slides from nodeconf 2011
@mattetti
mattetti / fsevents.rb
Created March 18, 2011 07:19
FSEvents API implementation in MacRuby
if RUBY_ENGINE == 'macruby'
framework 'CoreServices'
WATCHED_EXTS = "rb,builder,erb,nokogiri"
PASSENGER_RESTART_FILE = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp", "restart.txt"))
DELAY = 3
def modified_files(path)
Dir.glob("#{File.expand_path(path)}/*.{#{WATCHED_EXTS}}").map do |filename|
begin
@uhop
uhop / admin.py
Created March 14, 2011 00:31
Adding Dojo's rich editor to Django's Admin.
# Example how to add rich editor capabilities to your models in admin.
from django.contrib.admin import site, ModelAdmin
import models
# we define our resources to add to admin pages
class CommonMedia:
js = (
'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.