Skip to content

Instantly share code, notes, and snippets.

@mihai-scurtu
mihai-scurtu / gist:4a488007cfd150f09a4d
Last active August 15, 2018 11:30
Integrating TinyMCE in an ember-cli app

Integrating TinyMCE in an ember-cli app

TinyMCE is a javascript WYSIWYG editor that is highly configurable and has a ton of features and plugins. It integrates with jQuery and, with a bit of work, it can be integrated in your ember-cli app.

Step 1: Install TinyMCE:

bower install --save tinymce

Step 2: Import the required files into your app via broccoli. In order to do that you will need a plugin called broccoli-static-compiler:

order_code = 'ABCXXX'
variant_id = 123
variant_units = 3 # unidades a agregar
# encuentra pedido existente
order = shop.order(id: order_code) # si no existe, creamos una nueva
# construimos un array de line_items
# a partir de los items del pedido existente
# si es que la variante que queremos agregar
@baamenabar
baamenabar / obtener_costo_envio_paquete.php
Last active March 31, 2019 02:27 — forked from nikoskip/valores_chilexpress.php
Obtener costos de envío por Chilexpress, usando el formulario de cálculo que tienen ellos. A falta de un API, hay que hacerse uno. Todo mérito a @nikoskip
<?php
/**
* Una simple función para obtener los costos de envío de un paquete mediante Chilexpress.
* Como única dependencia se necesita de la liberia PHP Simple HTML DOM Parser: http://simplehtmldom.sourceforge.net/
*
* Para poder comunicarse con Chilexpress, se debe tener la lista de todas las comunas que ellos utilizan y el código
* que le asignan a cada una. En este archivo, al final, podrás encontrar el listado, el cual podrás parsear fácilmente
*/
@owainlewis
owainlewis / model_to_csv.rb
Created July 2, 2012 17:58
Export Rails model to CSV
# Export Active Record model as a CSV file
#
def self.render_csv active_record_model
CSV.generate do |csv|
csv << active_record_model.column_names
active_record_model.all.each do |m|
values = active_record_model.column_names.map{ |f| m.send f.to_sym }
csv << values
end
end
@mitio
mitio / deploy.rb
Created August 23, 2013 15:38
Sidekiq + Capistrano + Ubuntu Upstart
# config/deploy.rb
namespace :upstart do
desc 'Generate and upload Upstard configs for daemons needed by the app'
task :update_configs, except: {no_release: true} do
upstart_config_files = File.expand_path('../upstart/*.conf.erb', __FILE__)
upstart_root = '/etc/init'
Dir[upstart_config_files].each do |upstart_config_file|
config = ERB.new(IO.read(upstart_config_file)).result(binding)
@jimmyeisenhauer
jimmyeisenhauer / gist:2795771
Created May 27, 2012 00:58
Drop and Rebuild Heroku database
heroku pg:reset SHARED_DATABASE --confirm fasterfaster
heroku run rake db:migrate
heroku run console
Rails.cache.clear
heroku restart
- manually add one record to test
- run performance test
@BaylorRae
BaylorRae / baylorrae.zsh-theme
Created December 19, 2011 23:15
This is my oh-my-zsh theme.
# Baylor Rae's Prompt Theme
# based on wunjo prompt theme and modified for oh-my-zsh
# shows me all files and folders when I change directories
cd() { builtin cd "$@"; ls }
# uses ~ instead of /Users/baylorrae/
pwd() { print -D $PWD }
# I substituted my own so the commit times were live
@stas
stas / deploy.rb
Created January 15, 2013 15:34
Mina Deploy Task (Rails + Puma + Delay Job + rbenv)
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
@lopezjurip
lopezjurip / gist:a817e96ec833e7667274
Last active June 9, 2020 22:26
DigitalOcean+Rails+Puma+Dokku+Postgress
# Based on: http://donpottinger.net/blog/2014/11/17/bye-bye-heroku-hello-dokku.html
# Add to gemfile:
ruby '2.1.2'
gem 'pg'
gem 'puma'
gem 'rails_12factor'
gem 'searchkick'
gem 'typhoeus'
@hiteshkr
hiteshkr / Graylog02DarkTheme.css
Last active October 18, 2020 10:49
CSS for Dark theme for Graylog 02
@-moz-document url-prefix("https://graylog"), url-prefix("https://gettingstarted.graylog.org") {
body {
background-color: black;
color: #999;
}
h1, h2, h3, h4, h5, h6 {
color: #ddd;
}
svg {
background-color: #666;