Skip to content

Instantly share code, notes, and snippets.

View halilim's full-sized avatar

Halil Özgür halilim

View GitHub Profile
@rogal111
rogal111 / paperclip_transliterate.rb
Created July 10, 2012 10:28
Transliterate Paperclip file name to use in URLs
# put this file in config/initializers
#
# USAGE:
# in your paperclip model:
# has_attached_file :document
# before_post_process { |c| transliterate_file_name(:document) }
module TransliteratePaperclip
def transliterate_file_name(paperclip_file)
@nike-17
nike-17 / gist:4173162
Created November 30, 2012 01:33
LinkedIn Endorse all
//if you need to andorse all in linkedin just go in to your profil and enter in browser console
setInterval(function(){document.getElementsByClassName('endorse-all-btn')[0].click()}, 5000)
//an leave your tab for some time
@mameier
mameier / deploy.rb
Created July 18, 2013 10:40
capistrano hack to procompile locally
desc "deploy precompiled assets"
task :sync_assets, :roles => :app do
run_locally 'mv public/no_assets public/assets || true'
run_locally 'if [ `find app/assets lib/assets vendor/assets -type f -newer public/assets | wc -l` -gt 0 ] ; then bundle exec rake assets:precompile ; fi'
servers = find_servers_for_task(current_task)
servers.each do |server|
run_locally "rsync -va --delete public/assets/ #{user}@#{server}:#{release_path}/public/assets/"
end
run_locally 'mv public/assets public/no_assets || true'
end
@chetan
chetan / fix_wget_ca.sh
Created June 12, 2012 14:37
How to fix wget certificate issues
wget --no-check-certificate https://raw.github.com/bagder/curl/master/lib/mk-ca-bundle.pl
perl mk-ca-bundle.pl && rm certdata.txt
mkdir -p ~/.ssl/ && mv ca-bundle.crt mk-ca-bundle.pl ~/.ssl
echo "ca_certificate = ~/.ssl/ca-bundle.crt" >> ~/.wgetrc
@marinalohova
marinalohova / rails_admin_approve_review.rb
Created March 14, 2012 19:49
Custom action for RailsAdmin
require 'rails_admin/config/actions'
require 'rails_admin/config/actions/base'
module RailsAdminApproveReview
end
module RailsAdmin
module Config
module Actions
class ApproveReview < RailsAdmin::Config::Actions::Base

Getting started

First add your twitter username and password. Then server.rb and once it's started open websocket.html in your browser. You should see some tweets appear. If not take a look at the javascript console.

@1st8
1st8 / gist:3128135
Created July 17, 2012 08:47
God process monitoring + Upstart + rbenv
description "God Process Monitoring"
author "Christoph Geschwind <christoph@mixxt.net>"
start on runlevel [2345]
stop on runlevel [!2345]
respawn # respawn the service if it dies
respawn limit 5 10 # stop respawning if it fails 5 times in 10 seconds
pre-start script
@dakshhmehta
dakshhmehta / laravel-jQuery-validation-rule.php
Last active May 27, 2018 19:13
Convert Laravel validation rules to jQuery validation rules to enable client-side validation. See more information about jQuery validation at http://jqueryvalidation.org/
<?php
use LaravelBook\Ardent\Ardent;
// You can extend Eloquent
// Example: http://laravel.io/bin/89V7
class JsModel extends Ardent {
/**
* Mapping in an array of Laravel Validator class rules
* and jQuery validator rules in format as
class ApplicationController < ActionController::Base
...
#Problem:
#In rails 3.0.1+ it is no longer possible to do this anymore;
# rescue_from ActionController::RoutingError, :with => :render_not_found
#
#The ActionController::RoutingError thrown is not caught by rescue_from.
#The alternative is to to set a catch-all route to catch all unmatched routes and send them to a method which renders an error
#As in http://techoctave.com/c7/posts/36-rails-3-0-rescue-from-routing-error-solution
@coldnebo
coldnebo / Default (OSX).sublime-keymap -- User
Created February 3, 2012 16:21
Sublime Text 2 fix for OSX home/end keys
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} }