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
# Filter payment methods in Spree depending on the shipping name, | |
# use the following snippet within your activation method to | |
# make it work: | |
# | |
# CheckoutsController.class_eval { include FilterPaymentMethods } | |
# | |
# The magic happens within the InstanceMethods module, change the | |
# regexp to fit your needs. | |
# | |
# Kai Krakow, http://github.com/kakra |
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
# Clear existing task so we can replace it rather than "add" to it. | |
Rake::Task["deploy:compile_assets"].clear | |
desc "Precompile assets locally and then rsync to web servers" | |
task :compile_assets do | |
# compile assets locally | |
run_locally do | |
with rails_env: fetch(:stage) do | |
execute :bundle, "exec rake assets:precompile" | |
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
# Clear existing task so we can replace it rather than "add" to it. | |
Rake::Task["deploy:compile_assets"].clear | |
desc "Precompile assets locally and then rsync to web servers" | |
task :compile_assets do | |
on roles(:web) do | |
rsync_host = host.to_s | |
run_locally do | |
with rails_env: :production do ## Set your env accordingly. |
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
/** @jsx React.DOM */ | |
'use strict'; | |
var React = require('react'); | |
var ContentEditableLabel = React.createClass({ | |
propTypes: { | |
tag: React.PropTypes.func, |
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
'use strict'; | |
var React = require('react-native'); | |
var Firebase = require('firebase'); | |
var { | |
AppRegistry, | |
StyleSheet, | |
Text, | |
View, | |
TextInput, |
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
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
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
const Form = t.form.Form; | |
const postOptions = t.struct({ | |
publication: t.String, | |
tags: t.String, | |
more: t.String, | |
facebook: t.Boolean | |
}) | |
const 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
""" | |
Programming task | |
================ | |
The following is an implementation of a simple Named Entity Recognition (NER). | |
NER is concerned with identifying place names, people names or other special | |
identifiers in text. | |
Here we make a very simple definition of a named entity: A sequence of | |
at least two consecutive capitalized words. E.g. "Los Angeles" is a named |
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
Rails Date Formats – strftime | |
StrFTime Format Codes for Ruby on Rails | |
Year | |
%Y year with century 2007 | |
%y year without century 07 | |
%C century number (year divided by 100) 20 | |
Month | |
%B full month name January |
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
--- | |
format_version: 1.1.0 | |
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git | |
app: | |
envs: | |
- BITRISE_PROJECT_PATH: ios/pro_mobile.xcodeproj | |
opts: | |
is_expand: false | |
- BITRISE_SCHEME: pro_mobile | |
opts: |
OlderNewer