Skip to content

Instantly share code, notes, and snippets.

View tmm1's full-sized avatar

Aman Gupta Karmani tmm1

View GitHub Profile
@lwe
lwe / brew-services.rb
Created January 5, 2011 13:13
External script for homebrew to simplify starting services via launchctl, out of the box support for any formula which implements #startup_plist.
#!/usr/bin/env ruby -w
# brew-services(1) - Easily start and stop formulas via launchctl
# ===============================================================
#
# ## SYNOPSIS
#
# [<sudo>] `brew services` `list`<br>
# [<sudo>] `brew services` `restart` <formula><br>
# [<sudo>] `brew services` `start` <formula> [<plist>]<br>
From c259a69c7e75f29d45fd0bbf47899d15e71e2e79 Mon Sep 17 00:00:00 2001
From: Llorx <dallorx@gmail.com>
Date: Sat, 6 Aug 2016 14:34:50 +0200
Subject: [PATCH] Bitrate on-the-fly PoC
---
ffmpeg.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 74 insertions(+), 1 deletion(-)
diff --git a/ffmpeg.c b/ffmpeg.c
@tmm1
tmm1 / bench.rb
Created June 30, 2010 03:12
performance improvements for Bundler and Gem::Version#<=>
require 'rubygems'
# diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb
# index 50d8204..4962ce1 100644
# --- a/lib/rubygems/version.rb
# +++ b/lib/rubygems/version.rb
# @@ -295,12 +295,16 @@ class Gem::Version
# rhsize = other.segments.size
# limit = (lhsize > rhsize ? lhsize : rhsize) - 1
#
#import <Foundation/Foundation.h>
@interface KKSimpleAirPlay2Player : NSObject
- (id)initWithURL:(NSURL *)inURL;
- (void)play;
- (void)pause;
@property (readonly, getter=isStopped) BOOL stopped;
@end
@tmm1
tmm1 / gist:329682
Created March 11, 2010 21:31
EM Chat Server Demo
require 'rubygems'
require 'eventmachine'
require 'em-http' # gem install em-http-request
require 'yajl' # gem install yajl-ruby
class String
def bold
"\033[1m#{self}\033[0m"
end
end
@protocool
protocool / caveatPatchor.js
Created February 11, 2011 01:00
Sample Propane caveatPatchor.js file
/**
Sample Propane caveatPatchor.js file based on tmm1's avatar hack.
You'll need at least version 1.1.1 to experiment with this:
http://propaneapp.com/appcast/Propane.1.1.1.zip
Once I'm sure exposing this hack-injection point doesn't cause problems
I'll do an official auto-updating version.
As of version 1.1.1, Propane will load and execute the contents of

FriendlyId uses Rails's extending method to avoid overwriting your model's find method. Internally this is implemented similar to this:

def self.friendly
  all.extending(friendly_id_config.finder_methods)
end

This however comes with a performance impact, because extending invokes Ruby's extend, which blows away MRI's method cache. To work around this, FriendlyId lets you include a :finders module which overrides your model's find to increase performance.

anonymous
anonymous / frozen_string.diff
Created November 26, 2013 04:08
diff --git a/compile.c b/compile.c
index 9ff3bf5..306fd80 100644
--- a/compile.c
+++ b/compile.c
@@ -172,10 +172,10 @@ r_value(VALUE value)
(((rb_iseq_t*)DATA_PTR(iseq))->filepath)
#define NEW_ISEQVAL(node, name, type, line_no) \
- new_child_iseq(iseq, (node), (name), 0, (type), (line_no))
+ new_child_iseq(iseq, (node), rb_str_frozen_literal(name), 0, (type), (line_no))
@alloy
alloy / gist:7527832
Created November 18, 2013 13:39
VIM config to deal with (MRI) Ruby’s C source code indentation.
" These VIM rules match the MRI C indentation rules.
"
" To enable use of this project specific config, add the following to your
" ~/.vimrc:
"
" " Enable per-directory .vimrc files
" set exrc
" " Disable unsafe commands in local .vimrc files
" set secure
@cypriss
cypriss / action_mailer_no_tmail.rb
Created August 14, 2012 17:32
Use TMail -> Mail gem in Rails 2.3
require 'action_mailer'
require 'mail'
module ActionMailer
class Base
def clean_address(str)
EmailAddress.parse(str, :no_default_name => true).quoted rescue str
end