Skip to content

Instantly share code, notes, and snippets.

=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@alnutile
alnutile / deploy.rb
Last active December 20, 2015 22:29
Setting up s3, paperclip and ckeditor with a s3-us-west-2.amazonaws.com type domain. From here all uploads via ckeditor or a paperclip manage file just worked. Also cap deploy so this symlink is in place
# this post helped here
# http://stackoverflow.com/questions/705054/where-do-you-put-your-app-config-files-when-deploying-rails-with-capistrano-and
# get your file to the server under shared
# then update cap to handle the symlink update
namespace :deploy do
task :start do ; end
task :stop do ; end
# this task
task :symlink_shared do
@alnutile
alnutile / gist:6223340
Created August 13, 2013 17:09
Og access patch. Just place in the og_access folder and run patch -p0 < patch_name
--- og_access.module 2013-08-13 12:00:30.000000000 -0500
+++ og_access.module.monkey_patched 2013-08-13 12:05:38.000000000 -0500
@@ -167,10 +167,11 @@
// Add public checkbox to node edit form.
function og_access_alter_nongroup_form(&$form, $form_state, $node) {
- global $user;
-
+ global $user;
// If user has no subscriptions, don't bother with Public checkbox - it's meaningless.
/**
* File Path
* themes/incrediblewp/template-portfolio4col-content.php
* This is the alter pages that are Wordpress Pages that then have under it the
* Template 4 column like the parking url.
*/
// Line 123
<?php
$excerpt = get_the_excerpt();
@alnutile
alnutile / BehatEditorSauceLabsWrapper.inc
Created September 28, 2013 00:34
Ah I missed two obvious things. Sure helps to read the spec. 1. .php not .inc 2. Class = Name of file
//src/Drupal/BehatEditorSauceLabs/BehatEditorSauceLabsWrapper.inc
<?php
namespace Drupal\BehatEditorSauceLabs;
class BehatEditorSauceLabsWrapper {
}
@alnutile
alnutile / behat_editor_file_parsing.inc
Last active December 24, 2015 07:09
using switch
/**
* @param $string
* Features should have trailing lines
* 1. The benefits
* 2. The role of the user
* 3. The description
* @return array
*/
function behat_editor_string_feature($string, $scenario, $count, $direction) {
$results = array();
@alnutile
alnutile / myservices_resource.php
Created October 7, 2013 12:25
Services Target Action attempt 1
<?php
/**
* Implementation of hook_services_resources().
*/
function behat_editor_services_resources() {
$path = drupal_get_path('module', 'behat_editor');
return array('behat_editor' =>
array('targeted_actions' => array(
'run' => array(
@alnutile
alnutile / composer.json
Created October 9, 2013 09:22
This only causes autoload_namespaces.php to work if I add require to the object.
{
"name": "drupal/behat_editor_saucelabs",
"type": "drupal-module",
"description": "Runs behat tests on saucelabs.",
"homepage": "https://github.com/alnutile/behat_editor_saucelabs",
"license": "GPL-2.0",
"authors": [
{
"name": "Alfred Nutile",
"email": "alfrednutile@gmail.com",
@alnutile
alnutile / update_database.rb
Last active December 25, 2015 05:49
Quick Script to automate the update of heroku db from dev to basic
site = ARGV[0]
if site
command = %x[heroku addons:add --app #{site} pgbackups]
puts "Added PgBackups"
command = %x[heroku addons:add --app #{site} heroku-postgresql:basic]
pg_info = %x[heroku pg:info --app #{site}]
pg_info_to_array = pg_info.split("\n")
db_row = pg_info[0].split(" ")
database_name = db_row[1]
@alnutile
alnutile / RESTService.inc
Last active December 25, 2015 06:38
Services
//protected function resolveController($resource, &$operation)
if ( $request_method == 'POST'
&& $canon_path_count >= 2
&& isset($resource['targeted_actions'][$canonical_path_array[1]])
&& $this->checkNumberOfArguments($canon_path_count, $resource['targeted_actions'][$canonical_path_array[1]], 1)
&& !empty($canonical_path_array[0])
) {
$operation_type = 'targeted_actions';
$operation = $canonical_path_array[1];
}