This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
module ThreadSafe | |
def self.included(base) | |
base.extend(ThreadSafeClassMethods) | |
base.threadsafe_class_mutex = Mutex.new | |
end | |
module ThreadSafeClassMethods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Do this before doing bundle install | |
# Make sure you have Xcode installed with command line utilities. | |
# Install Home Brew (if you already have it installed update it): | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew update --system | |
brew update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change to a directory given a full or partial name | |
# You don't have to wrap directory names in quotes either | |
function chd() { | |
friendlyChgDirOptions | |
if [ -n "$1" ]; then | |
if [ -n "`ls "$@"* 2>/dev/null`" ]; then | |
cd "$1"* | |
else | |
echo "-bash: chd: "$1": No directory found from partial name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shopt -s nocaseglob |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rss' | |
require 'open-uri' | |
require 'net/http' | |
# Your subscription ID | |
sub_id = "xxx" | |
url = "http://railscasts.com/subscriptions/#{sub_id}/episodes.rss" | |
puts "Reading RSS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- index.html --> | |
<html> | |
<head> | |
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> | |
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> | |
<META HTTP-EQUIV="EXPIRES" CONTENT="0"> | |
<META HTTP-EQUIV="REFRESH" CONTENT="0;https://mywebsite.com/ab.007/story.html"> | |
<script type="text/javascript"> | |
window.location = "https://mywebsite.com/ab.007/story.html" | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#Thread.abort_on_exception = true | |
require 'fiber' | |
require 'benchmark' | |
class FiberRing | |
attr_reader :id | |
def initialize(id) | |
@id = id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CAIRO_VERSION_STRING = CAIRO_VERSION_MAJOR.CAIRO_VERSION_MINOR.CAIRO_VERSION_MICRO | |
attach_function :cairo_version, [ ], :int | |
attach_function :cairo_version_string, [ ], :string | |
class CairoMatrix < FFI::Struct | |
layout( | |
:xx, :double, | |
:yx, :double, | |
:xy, :double, | |
:yy, :double, | |
:x0, :double, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "ffi" | |
class TimeValue < FFI::Struct | |
layout :seconds, :int, | |
:microseconds, :int | |
end | |
#struct task_basic_info | |
#{ | |
# integer_t suspend_count; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <mach/mach_init.h> | |
#include <mach/mach_port.h> | |
#include <mach/task_info.h> | |
#include <mach/thread_act.h> | |
#include <mach/vm_map.h> | |
#include <mach/task.h> | |
#include <sys/types.h> |
NewerOlder