Skip to content

Instantly share code, notes, and snippets.

View koriroys's full-sized avatar
🐢
Slow and Steady

Kori Roys koriroys

🐢
Slow and Steady
View GitHub Profile
@dysinger
dysinger / docker-ruby-fpm.sh
Last active August 29, 2015 13:56
Stop using rbenv & rvm on servers. plz. kthnx.
cat > Dockerfile <<\EOF
FROM ubuntu:12.04
RUN apt-get update
RUN apt-get install -y ruby1.9.3 build-essential \
libc6-dev libffi-dev libgdbm-dev libncurses5-dev \
libreadline-dev libssl-dev libyaml-dev zlib1g-dev
RUN gem install fpm --bindir=/usr/bin --no-rdoc --no-ri
RUN apt-get install -y curl
RUN curl ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.gz|tar oxzC /tmp
WORKDIR /tmp/ruby-1.9.3-p484
@thegrubbsian
thegrubbsian / product.rb
Created February 11, 2012 19:00
QueryBuilder Example
class Product < ActiveRecord::Base
def self.find_by_criteria(params)
query = where("id IS NOT null") # A little odd but not sure how to get an ActiveRecord::Relation that returns "all"
query = query.where("price = ?", params[:price]) if params[:price].present?
query = query.where("manufacturer = ?", params[:manufacturer]) if params[:manufacturer].present?
query = query.where("retailer = ?", params[:retailer]) if params[:retailer].present?
query = query.where("category = ?", params[:category]) if params[:category].present?
query
end
@coreyhaines
coreyhaines / Gemfile
Created March 14, 2012 23:22
Running a worker
source :rubygems
@daytonn
daytonn / file_conditional.sh
Created June 11, 2012 21:36
Conditionally load an .aliases file in .bash_profile
# Include alias file
if [ -f ~/.aliases ]
then
source ~/.aliases
fi
@thegrubbsian
thegrubbsian / deploy.rake
Created June 13, 2012 17:22
Heroku Deploy Rake Task
namespace :deploy do
HEROKU_ACCOUNT = "account_name"
MAINLINE_BRANCH = "master"
STAGING_REPO = "app-name-staging"
PRODUCTION_REPO = "app-name-production"
def make_git_timestamp
"#{@env}-deploy-#{Time.now.to_s.gsub(/:/, "-").gsub(/\s/, "-").gsub(/--/, "-")}"
end
@daytonn
daytonn / Guardfile
Created March 20, 2013 19:38
Guardfile
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
group :interactive do
guard 'spork', :rspec_env => {'RAILS_ENV' => 'test'}, :wait => 50 do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
@xypaul
xypaul / tinymce-ember.js
Created May 14, 2014 06:32
TinyMCE 4 Ember Component
App.TinymceEditorComponent = Ember.Component.extend({
// Warning!!! only use tinyMCE not tinymce !!!
editor: null,
data: {},
watchData: true,
didInsertElement: function(){
var _this = this;
// The magic config - http://www.tinymce.com/wiki.php/Configuration
var config = {};
@knownasilya
knownasilya / ajax.js
Last active June 22, 2016 14:37
RSVP jquery ajax wrapper
function ajax(url, options) {
return new Ember.RSVP.Promise(function (resolve, reject) {
options = options || {};
options.url = url;
options.success = function (data) {
Ember.run(null, resolve, data);
};
options.error = function () {
@Gaurav0
Gaurav0 / application.route.js
Last active June 18, 2018 10:41
Mockjax Sample
import Ember from 'ember';
export default Ember.Route.extend({
init() {
this._super(...arguments);
$.mockjax({
url: '/api/mock',
responseText: {
text: "someText"