This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mysql db backup and restore for rails | |
# by David Lowenfels <david@internautdesign.com> 4/2011 | |
require 'yaml' | |
namespace :db do | |
def backup_prep | |
@directory = File.join(RAILS_ROOT, 'db', 'backup') | |
@db = YAML::load( File.open( File.join(RAILS_ROOT, 'config', 'database.yml') ) )[ RAILS_ENV ] | |
@db_params = "-u #{@db['username']} #{@db['database']}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module JSHelpers | |
module JQueryUI | |
# type inside an autocomplete field and pick a value. | |
# | |
# @param [String] field selector of the autocomplete field | |
# @param [Hash] options details about what to search and what to select | |
# @param options [String] :with the text to type in the autocomplete field | |
# @param options [String] :select the text value of the autocomplete resuilt you | |
# want to pick. If this option is not present, the first result will be picked. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "manager", | |
"version": "0.0.1", | |
"private": true, | |
"scripts": { | |
"start": "node node_modules/react-native/local-cli/cli.js start", | |
"test": "jest" | |
}, | |
"dependencies": { | |
"firebase": "^3.7.8", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shopmaster/frontend/app/routes/grocery-lists/new.js | |
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
setupController: function(controller, model) { | |
controller.set('model', model); | |
}, | |
model: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save_card | |
# Stubbed method on the api wrapper | |
response = Api::save_card(card_info) | |
if response.success? | |
# do something because it was saved | |
else | |
# let user know it wasnt saved | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class API::V1::BaseController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Preferred correct-incorrect-interactive | |
<div class="correct-incorrect-interactive"> | |
<ol class="questions"> | |
<li class="question"> | |
<p><strong>This statement says the hospital can call your primary care doctor and talk with him/her about your treatment.</strong></p> | |
<ol class="choices"> | |
<li class="choice correct"><i></i><strong>TRUE</strong></li> | |
<li class="choice incorrect"><i></i><strong>FALSE</strong></li> | |
</ol> | |
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// REQUIRES JQUERY AND BACKBONE TO BE LOADED FIRST | |
// | |
// With additions by Maciej Adwent http://github.com/Maciek416 | |
// If token name and value are not supplied, this code Requires jQuery | |
// | |
// Adapted from: | |
// http://www.ngauthier.com/2011/02/backbone-and-rails-forgery-protection.html | |
// Nick Gauthier @ngauthier | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In config/initializers/local_override.rb: | |
require 'devise/strategies/authenticatable' | |
module Devise | |
module Strategies | |
class LocalOverride < Authenticatable | |
def valid? | |
true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/dns/resolver' | |
# Custom Domain | |
# | |
# Require net-dns gem | |
# | |
# A Rack middleware to to resolve the custom domain to original subdomain | |
# for your multi telent application. | |
# | |
# It's all transperant to your application, it performs cname lookup and |
NewerOlder