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
import { AppiumDriver, createDriver, SearchOptions } from 'nativescript-dev-appium' | |
import { runType } from 'nativescript-dev-appium/lib/parser' | |
import { Direction } from 'nativescript-dev-appium/lib/direction' | |
import { assert } from 'chai' | |
const isAndroid: string = runType.includes('android') | |
describe('E2E Specs', () => { | |
let driver: AppiumDriver |
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
# Override the default confirm dialog by rails | |
$.rails.allowAction = (link) -> | |
if link.data('confirm') | |
$.rails.showConfirmationDialog(link) | |
false | |
else | |
true | |
# User click confirm button | |
$.rails.confirmed = (link) -> |
The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.
- Single Responsibility Principle: a class should have only a single responsibility
- Open-Closed Principle: Software entities should be open for extension, but closed for modification (inherit instead of modifying existing classes).
- Liskov Substitution: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
- Interface Segregation: Many client-specific interfaces are better than one general-purpose interface.
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
# encoding: UTF-8 | |
# | |
# $ rake checkout new_branch_name | |
# | |
# Via https://gist.github.com/jonlemmon/4076864 | |
# | |
# 1. Roll back any migrations on your current branch which do not exist on the | |
# other branch | |
# 2. Discard any changes to the db/schema.rb file | |
# 3. Check out the other branch |
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
# A class-based template for jQuery plugins in Coffeescript | |
# | |
# $('.target').myPlugin({ paramA: 'not-foo' }); | |
# $('.target').myPlugin('myMethod', 'Hello, world'); | |
# | |
# Check out Alan Hogan's original jQuery plugin template: | |
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template | |
# | |
(($, window) -> |
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
<?php | |
/** | |
* Standard Tab Code from woocommerce-hooks.php | |
*/ | |
/* Product page tabs */ | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 ); | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 ); | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 ); | |
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 ); |
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 DelayedJobObserver < Mongoid::Observer | |
observe Delayed::Job | |
class << self | |
attr_accessor :total_processed | |
attr_accessor :total_errors | |
attr_accessor :enabled | |
def enabled? | |
!! DelayedJobObserver.enabled |
Recently, I had a staging database on Heroku that was running on the Ronin database (which was originally the lowest-sized DB you could get at Heroku). Since they added two new options, Crane and Kappa, we wanted to take advantage of the cost savings. Here's how you can migrate your Ronin DB to Crane (or any other plan).
The old database was named BROWN while the new one is CRIMSON. You can determine this by running:
heroku pg:info --app myapp-staging
-
Add Crane database
heroku addons:add heroku-postgresql:crane --app myapp-staging
heroku pg:wait --app myapp-staging
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
=semantic_form_for [:admin, @dog], validate: true, html: {multipart: true} do |f| | |
=f.inputs do | |
=f.input :name | |
=f.input :kennel_name | |
=f.input :birthdate | |
=f.input :gender, as: :radio, collection: {'Tik' => 'F', 'Hane' => 'M'} | |
=f.input :father_id, as: :select, collection: @dogs | |
=f.input :mother_id, as: :select, collection: @bitches | |
=f.semantic_fields_for :pictures do |pic| |
NewerOlder