Skip to content

Instantly share code, notes, and snippets.

View tvdeyen's full-sized avatar
🎧

Thomas von Deyen tvdeyen

🎧
View GitHub Profile
@tvdeyen
tvdeyen / _tinymce_enable.html.erb
Created April 10, 2015 15:50
Enable Alchemy CMS build in TinyMCE for Spree text areas.
<!-- app/views/admin/shared/_tinymce_enable.html.erb -->
<script charset="utf-8">
var tinyMCEPreInit = {
base: '<%= asset_path('tinymce') %>',
suffix: '.min'
};
$(function() {
@jlyonsmith
jlyonsmith / IAM_Backup_User_Policy.json
Last active September 24, 2016 22:43
Script and support files for backing up Redmine database to AWS S3 bucket. Replace 'xxx' with correct values.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::xxx-redmine-backups"
@phoet
phoet / acceptance_spec_helper.rb
Last active December 23, 2015 19:29
don't put all your stuff in /spec
require 'simplecov'
SimpleCov.command_name "acceptance"
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/poltergeist'
@pallan
pallan / chiliproject_to_redmine.rb
Created September 22, 2013 19:33
Run this script from the root of your Redmine installation to convert from a Chiliproject installation
# encoding: UTF-8
# Chiliproject to Redmine converter
# =================================
#
# This script takes an existing Chiliproject database and
# converts it to be compatible with Redmine (>= v2.3). The
# database is converted in such a way that it can be run multiple
# times against a production Chiliproject install without
# interfering with it's operation. This is done by duplicating
@flarik
flarik / dot.powrc.sh
Created June 12, 2013 10:25
Pow's .porwrc config file for use with RVM's config files .rvmrc or .ruby-version (+ optional .ruby-gemset)
if [ -f "${rvm_path}/scripts/rvm" ]; then
source "${rvm_path}/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc"
elif [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ]; then
rvm use `cat .ruby-version`@`cat .ruby-gemset`
elif [ -f ".ruby-version" ]; then
rvm use `cat .ruby-version`
@phoet
phoet / sinnlos.html
Created December 3, 2012 11:54
sinnlose dropdowns
<option value="001">Herr</option>
<option value="002">Frau</option>
<option value="Dr.">Dr.</option>
<option value="Prof.">Prof.</option>
<option value="Dr. Dr.">Dr. Dr.</option>
<option value="Prof. Dr.">Prof. Dr.</option>
<option value="Prof. Dr. Dr.">Prof. Dr. Dr.</option>
<option value="Konsul">Konsul</option>
<option value="Generalkonsul">Generalkonsul</option>
@hmans
hmans / cheesecake.md
Last active April 28, 2020 20:56
Motherfucking Cheesecake

MOTHERFUCKING CHEESECAKE

Zutaten:

Für den Boden:

  • 150g Vollkornbutterkekse
  • 2 EL Zucker
  • Prise Zimt
  • 60g weiche Butter
@mperham
mperham / after.rb
Created July 4, 2012 19:30
Thread-friendly shared connection
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection }
end
end
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
@ku1ik
ku1ik / nginx.conf
Created April 25, 2012 19:24 — forked from lucasmazza/conf.md
Nginx upstart script that WORKS with Passenger.
description "nginx http daemon"
start on runlevel [2]
stop on runlevel [016]
console owner
exec /opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf -g "daemon off;"
respawn
@gberenfield
gberenfield / user.rb
Created March 20, 2012 01:34 — forked from andresgutgon/user.rb
Migrate Autholugic SHA512 Passwords to BCryt Devise Passwords
# Because we have some old legacy users in the database, we need to override Devises method for checking if a password is valid.
# We first ask Devise if the password is valid, and if it throws an InvalidHash exception, we know that we're dealing with a
# legacy user, so we check the password against the SHA1 algorithm that was used to hash the password in the old database.
#SOURCES OF SOLUTION:
# http://stackoverflow.com/questions/6113375/converting-existing-password-hash-to-devise
# https://github.com/binarylogic/authlogic/blob/master/lib/authlogic/crypto_providers/sha512.rb
# https://github.com/plataformatec/devise/blob/master/lib/devise/encryptors/authlogic_sha512.rb
alias :devise_valid_password? :valid_password?
def valid_password?(password)