Skip to content

Instantly share code, notes, and snippets.

config.assets.precompile += [
'public/framed.css',
'public/mobile.css', 'public/mobile.js', 'public/detectmobilebrowser.js',
'public/desktop.js',
'public/customer_styles/**/*.css*',
Proc.new {|path| (path =~ /^[a-z0-9]\w+.(css|js)$/) && !path.include?('tinymce/') }
]
def find(funky_hash, *args)
if funky_hash == 'foo'
//do something
else
super(*args)
end
end
def find_by_hstore(hstore_hash, *args)
query = hstore_hash.collect{|k,v| "#{k} @> #{v}" }
if args.length > 0
find_by(*args).where(query)
else
where(query)
end
end
class SomeFactory
def self.dosomething(class_name, *args)
Object.const_get(class_name).new(*args)
end
end
irb(main):005:0> require 'ostruct'
=> true
irb(main):006:0> t = OpenStruct.new({:test => "yolo"})
=> #<OpenStruct test="yolo">
irb(main):007:0> t.to_hash
=> nil
irb(main):008:0> t.to_h
=> {:test=>"yolo"}
irb(main):009:0>
@j-mcnally
j-mcnally / app.coffee
Created May 9, 2014 17:32
Application JS - Reopen ES6 modules
`import Resolver from 'ember/resolver';`
Ember.MODEL_FACTORY_INJECTIONS = true
class App extends Ember.Application
LOG_ACTIVE_GENERATION: true
LOG_MODULE_RESOLVER: true
LOG_TRANSITIONS: true,
# LOG_TRANSITIONS_INTERNAL: true,
[ERROR] [0.0.0.0-startStop-1] org.apache.catalina.core.ContainerBase.[red5Engine].[0.0.0.0].[/bluehammer-avalon] - StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blueHammer.scope' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Cannot resolve reference to bean 'red5.server' while setting bean property 'server'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'red5.server' is defined
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329) ~[spring-beans-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) ~[spring-beans-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)
#
#!/bin/sh -e
#
# Startup script for Red5
export RED5_HOME=/usr/share/red5/
start_red5="$RED5_HOME/red5-highperf.sh start"
stop_red5="$RED5_HOME/red5-shutdown.sh stop"
@j-mcnally
j-mcnally / gist:708584c913e41dd208c1
Last active November 28, 2019 13:15
Install Adobe Flash Builder 4.6 in Ubuntu / Linux Mint / Maybe others?

Install wine

apt-get install wine

Install wine tricks

apt-get install winetricks

Set wine to run in 32-bit mode (Append the following lines to .[bash|zsh]rc)