Skip to content

Instantly share code, notes, and snippets.

@adrienpoly
adrienpoly / application.html.erb
Last active March 22, 2024 08:14
Capybara / Stimulus test helper to ensure JS is ready when test starts
<!DOCTYPE html>
<html>
<head>
...
</head>
<body data-controller="js">
<%= yield %>
</body>
</html>
@pekhee
pekhee / connection.php
Created April 5, 2014 23:56
Setup database connection for Eloquent outside of Laravel.
<?php // Namespace DB;
use Illuminate\Database\Capsule\Manager as Capsule;
class Connection {
public function __construct()
{
$this->capsule = new Capsule;
// Same as database configuration file of Laravel.
@brynary
brynary / git.rb
Created December 7, 2010 19:05
git:warn_unpushed_changes cap task
Capistrano::Configuration.instance(:must_exist).load do
namespace :git do
task :warn_unpushed_changes do
master_rev = `git rev-parse master`.strip
origin_master_rev = `git rev-parse origin/master`.strip
if master_rev != origin_master_rev
puts "*" * 80
answer = Capistrano::CLI.ui.ask(" You have local commits that have yet to be pushed to origin. Continue? (y/N)")
exit(1) unless answer.downcase == 'y'