This file contains hidden or 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
Controller: | |
class ModlessController < ApplicationController | |
def model_params | |
params.require(:model).permit(:tag_list) | |
end | |
end | |
Model: |
This file contains hidden or 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 update | |
@model.update(model_params) | |
respond_with(@model) | |
end | |
def model_params | |
params.require(:model).permit( :name, :tag_list, :tags ) | |
end | |
end |
This file contains hidden or 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 ModelsController < ApplicationController | |
before_action :set_model, only: [:show, :edit, :update, :destroy] | |
respond_to :html, :json | |
def update | |
Rails.logger.info "==============" | |
Rails.logger.info params[:model][:tags] | |
Rails.logger.info params[:model][:tag_list] | |
Rails.logger.info "==============" | |
@model.update(model_params) |
This file contains hidden or 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
params.require(:modle).permit( | |
:name, :user_id,:image, | |
:tag_list, :tags, :description | |
) |
This file contains hidden or 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
COLOR_LIGHT_RED=$(tput sgr0 && tput bold && tput setaf 1) | |
COLOR_LIGHT_CYAN=$(tput sgr0 && tput bold && tput setaf 6) | |
COLOR_RESET=$(tput sgr0) | |
say -v ? | while read line; do | |
voice=`echo $line | awk '{ print $1 }'` | |
phrase=`echo $line | sed -E 's/^.+# //'` | |
echo "${COLOR_LIGHT_RED}say -v ${COLOR_LIGHT_CYAN}${voice}${COLOR_RESET} $phrase" | |
say -v $voice $phrase | |
done |
This file contains hidden or 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
<ReactCSSTransitionGroup transitionName="fadeIn"> | |
{this.state.loading && <Loading key={0} />} | |
{this.state.error && | |
<div className="alert alert-block alert-danger" key={1}> | |
Error: { messages[ this.state.error ] } | |
</div>} | |
{this.state.success && | |
<div className="alert alert-block alert-success" key={2}> | |
Success! | |
</div>} |
This file contains hidden or 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
// Top level component | |
<component> | |
<UserModal isOpen={this.state.whatever} /> | |
</component> | |
// UserModal | |
{ | |
render:function() { | |
return <BaseModal {...this.props}> |
This file contains hidden or 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
// Lets you call classSet with strings *and* objects | |
// Usage: classSet({a: true, b: false}, 'class1', null, 'class2'); class="a class1 class2" | |
function classSet() { | |
var classes = [], | |
arg, x, key; | |
for( x = 0; x < arguments.length; x++ ) { | |
arg = arguments[ x ]; | |
if( typeof arg === 'object' ) { |
This file contains hidden or 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
componentDidMount: function() { | |
UserStore.on( 'change', this.onStoreChange ); | |
}, | |
componentWillUnmount: function() { | |
UserStore.off( 'change', this.onStoreChange ); |
This file contains hidden or 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
var csv = require('csv'); | |
csv.parse(fs.readFileSync('./csv_with_headers.csv'), function(err, data) { | |
// Store the headers row | |
var headers = data[0]; | |
// Remove the headers row | |
data.shift(); | |
var objects = _.map(data, function(csvRow) { |
OlderNewer