Skip to content

Instantly share code, notes, and snippets.

View arkan's full-sized avatar

Florian Bertholin arkan

View GitHub Profile
CURRENT_PATH = File.expand_path(File.dirname(__FILE__))
def my_system(*cmd)
pid = fork do
exec(*cmd)
exit! 127
end
yield pid if block_given?
Process.waitpid(pid)
$?
# config/initializers/carrierwave.rb
CarrierWave.configure do |config|
config.grid_fs_database = "database_name"
config.grid_fs_host = 'localhost'
config.grid_fs_access_url = "/uploads"
config.storage = :grid_fs
end
@arkan
arkan / update_textmate_bundles.sh
Created December 14, 2011 23:32 — forked from dmnkhhn/update_textmate_bundles.sh
Update Textmate bundles
#!/bin/sh
#
# Update Textmate bundles
# Standard OS X Textmate bundle Verzeichnis
TEXTMATE_BUNDLES="$HOME/Library/Application Support/Textmate/Bundles"
# … ins Verzeichnis wechseln
echo "\n*** Wechsle ins Textmate bundle Verzeichnis..."
@arkan
arkan / gist:2062678
Created March 17, 2012 17:07 — forked from wkrsz/gist:1404434
Retrieve Gmail Thread IDs
# Code example for http://wojt.eu/post/13496746332/retrieving-gmail-thread-ids-with-ruby
def patch_net_imap_response_parser(klass = Net::IMAP::ResponseParser)
klass.class_eval do
def msg_att
match(T_LPAR)
attr = {}
while true
token = lookahead
case token.symbol
@arkan
arkan / gist:5219736
Created March 22, 2013 08:22
.tm_properties
# Basic Settings
#
# fontName = "Source Code Pro"
# fontSize = 13
# Extra files to include
#
myExtraIncludes = ".tm_properties,.htaccess,.gitignore"
fileBrowserGlob = "{*,$myExtraIncludes}"
include = "{$include,$myExtraIncludes}"
rails_env = ENV['RAILS_ENV']
raise "Please specify RAILS_ENV." unless rails_env
rails_root = ENV['RAILS_ROOT'] || File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
God.watch do |w|
w.dir = "#{rails_root}"
w.name = "resque-scheduler"
w.group = 'resque'
w.interval = 30.seconds
w.env = {"RAILS_ENV"=>rails_env, "BUNDLE_GEMFILE"=>"#{rails_root}/Gemfile"}
# code inspired from http://jainmarket.blogspot.com/2009/05/creating-custom-table-view-cell.html
class CustomCell < UITableViewCell
attr_accessor :primaryLabel
attr_accessor :secondaryLabel
def createLabels
@primaryLabel = UILabel.alloc.init
class MyCustomCell < UITableViewCell
# This method is used by ProMotion to instantiate cells.
def initWithStyle(style_name, reuseIdentifier: reuseIdentifier)
super
stylish
self
end
# A delegate method when the user clicks the Row(it's blue by default)
using System;
using System.Drawing;
using System.IO;
using System.Net;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
// A MonoTouch iOS Mail like example with a custom view and a UIWebView :
//
// http://stackoverflow.com/questions/10434444/zoom-a-uiwebview-like-ios-mail-app/10463431
{
// "auto_complete_commit_on_tab": true,
"auto_complete": true,
"tab_completion": true,
// "bold_folder_labels": true,
// "color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"color_scheme": "Packages/Dracula Color Scheme/Dracula.tmTheme",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[