Rails flash messages with AJAX requests & twitter-bootstrap 2.3
Forked from https://gist.github.com/linjunpop/3410235 Based on Stackoverflow answer: http://stackoverflow.com/a/10167659/656428
License: MIT
| class Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |
| <?php | |
| define('SHOPIFY_APP_SECRET', 'my_shared_secret'); | |
| function verify_webhook($data, $hmac_header) | |
| { | |
| $calculated_hmac = base64_encode(hash_hmac('sha256', $data, SHOPIFY_APP_SECRET, true)); | |
| return ($hmac_header == $calculated_hmac); | |
| } |
| #!/bin/bash | |
| #------------------------------------------------------------------------------- | |
| # PHPSWAP for changing php5 versions installed via macports in apache2 config. | |
| # | |
| # @author armin.pfurtscheller@locandy.com | |
| # @license MIT License | |
| # | |
| # Kindly referring to the following useful help pages: | |
| # http://mark-story.com/posts/view/maintaining-two-versions-of-php-with-macports |
Rails flash messages with AJAX requests & twitter-bootstrap 2.3
Forked from https://gist.github.com/linjunpop/3410235 Based on Stackoverflow answer: http://stackoverflow.com/a/10167659/656428
License: MIT
| namespace :db do | |
| desc "Outputs any invalid data records" | |
| task :invalid_records => :environment do | |
| puts "\n** Testing record validating in #{Rails.env.capitalize} environment**\n" | |
| ActiveRecord::Base.send(:subclasses).each do |model| | |
| puts "#{model} records (#{model.count})" | |
| next if model.count == 0 | |
| invalid = model.all.reject(&:valid?) | |
| if invalid.size.zero? |
| delimiter ;; | |
| drop procedure if exists build_catalog;; | |
| create procedure build_catalog(IN categories INT, IN products INT) | |
| begin | |
| SET @category_count = 1; | |
| SET @CATNAMEPREFIX = "Category "; | |
| SET @CATURLKEYPREFIX = "cat-"; | |
| SET @CATURLPATHPREFIX = "catpath-"; | |
| SET @ROOTCATEGORY = 2; | |
| SET @INCLUDEINMENU = 1; |
| # The number of customers who haveve only purchased once from December 2012 to December 2013 | |
| SELECT customers_in_segment | |
| FROM | |
| ( | |
| SELECT count(*) AS customers_in_segment, order_count | |
| FROM | |
| ( | |
| SELECT customer_id, min(created_at) AS first_order_at, count(*) AS order_count | |
| FROM sales_flat_order |
| upstream api_example_net { | |
| server api.example.net:4000; | |
| keepalive 600; | |
| } | |
| proxy_cache_path /var/cache/nginx/tag levels=1:2 keys_zone=tag:10m inactive=1d max_size=10g; | |
| server { | |
| listen 80; | |
| server_name api.example.net; |
Note: these are pretty rough notes I made for my team on the fly as I was reading through some pages. Some could be mildly inaccurate but hopefully not terribly so. I might resort to convenient fiction & simplification sometimes.
My top contenders, mostly based on popularity / community etc:
Mostly about MVC (or derivatives, MVP / MVVM).
| { | |
| "AWSTemplateFormatVersion": "2010-09-09", | |
| "Description": "Use these mappings for cloudwatch templates which launch a java process. They define a heap size close to (but never over) 70% of the available RAM, at multiples of 64 megabytes. No heap is declared over 32GB for performance reasons.", | |
| "Mappings" : { | |
| "AWSInstanceType2JavaMaxHeap" : { | |
| "t1.micro" : { "Heap" : "384m" }, | |
| "t2.micro" : { "Heap" : "640m" }, | |
| "t2.small" : { "Heap" : "1280m" }, | |
| "t2.medium" : { "Heap" : "2816m" }, | |
| "t2.large" : { "Heap" : "5g" }, |