Skip to content

Instantly share code, notes, and snippets.

View esdras's full-sized avatar

Esdras Mayrink esdras

View GitHub Profile
module ApplicationHelper
#
# @usage
#
# breadcrumb_for @post
# breadcrumb_for @post, 'comments'
# breadcrumb_for @post, @comment
# breadcrumb_for :namespace, @post, @comment
#
module Caboose #:nodoc:
module Acts #:nodoc:
module Paranoid
module InstanceMethods #:nodoc:
# by @esdras_mayrink
# 2010-03-13
# recover this record and its children.
def recover_with_all_associations!(recursively = true)
associations = self.class.reflect_on_all_associations(:has_many).map(&:name) + self.class.reflect_on_all_associations(:has_one).map(&:name)
# RemoveAccents version 1.0.3 (c) 2008-2009 Solutions Informatiques Techniconseils inc.
#
# This module adds 2 methods to the string class.
# Up-to-date version and documentation available at:
#
# http://www.techniconseils.ca/en/scripts-remove-accents-ruby.php
#
# This script is available under the following license :
# Creative Commons Attribution-Share Alike 2.5.
#
soffice -nologo -nofirststartwizard -headless -norestore -invisible "-accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;"
@esdras
esdras / gist:776485
Created January 12, 2011 17:19 — forked from anonymous/gist:776484
Add schedule capabilities to a resource
require 'ice_cube'
require 'active_support/all'
include IceCube
class Resource
attr_accessor :availability
def available_since(t = nil)
Dir['**/*.*'].each do |dir|
f = File.expand_path(e)
if File.exists?(f)
puts "#{f} - #{File.atime(f)}"
end
end
kzjfhlaskjdfhlkasjdf
@esdras
esdras / mysql-charset.sql
Created October 16, 2011 18:48
MySQL charset operation
SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = "schemaname";
SELECT CCSA.character_set_name FROM information_schema.`TABLES` T, information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA WHERE CCSA.collation_name = T.table_collation AND T.table_schema = "schemaname" AND T.table_name = "tablename";
SELECT character_set_name FROM information_schema.`COLUMNS` C WHERE table_schema = "schemaname" AND table_name = "tablename" AND column_name = "columnname";
<?php
// Script written by Vladislav "FractalizeR" Rastrusny
// http://www.fractalizer.ru
//MySQL connection settings
$db_server = 'localhost';
$db_user="root";
$db_password="";
mysql_connect($db_server, $db_user, $db_password) or die(mysql_error());