Skip to content

Instantly share code, notes, and snippets.

View weotch's full-sized avatar
👋
Heya

Robert Reinhard weotch

👋
Heya
View GitHub Profile
@weotch
weotch / commands.md
Last active August 29, 2015 14:02
Moving files between PagodaBox instances

Since you can't ssh from PagodaBox (the binary isn't installed), you can't rsync or scp between servers. Thus you need to copy them locally and then upload back up

  1. Enable ssh in PB for both servers.
  2. SSH to the first server and tar the uploads dir: tar -cvf uploads.tar shared/public/uploads. Not bothering with zipping causing it would take along time and it's all binary so I don't expect much compression help.
  3. Download the uploads.tar file to your comp.
  4. Delete uploads.tar file from server.
  5. Upload uploads.tar file to the root of second server.
  6. Connect to second server via SSH
  7. Uncompress it: tar -xvf uploads.tar
  8. Delete uploads.tar file from the second server
@weotch
weotch / new_gist_file.php
Created September 15, 2014 16:45
Make a visible column nullable in a separate migration, like when you forget.
DB::connection()->getPdo()->exec('ALTER TABLE `webinars` CHANGE `visible` `visible` TINYINT(1) NULL');
@weotch
weotch / migrate.php
Created October 1, 2014 21:23
Laravel foreign key example
$table->foreign('article_id')->references('id')->on('articles')->onUpdate('cascade')->onDelete('cascade');
// Set null style
$table->foreign('article_id')->references('id')->on('articles')->onUpdate('cascade')->onDelete('set null');
@weotch
weotch / notes.md
Last active August 29, 2015 14:16
Hardened JS queries
  • Another module, a mediator, would call query({types:"one,two"}) to intiate a search.
  • The query() method is debounced to prevent a bunch of successive calls if the person is actively using the UI. But, it has the leading and trailing attributes so that the first clicks is immediately handled and so that a final GET is made once the user is done being spastic, responding to the final search terms.
  • We save the xhr response so that we can use it to abort a still running request. Thus, if the request still hasn't finished by the time the trailing execution happens, the done() callback won't be fired for the previous query.
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ProductImagesTable extends Migration {
/**
* Run the migrations.
*
@weotch
weotch / blah.md
Last active September 18, 2017 22:02
Slack "material" theme
#263238,#295154,#294547,#80CBC4,#326063,#AEBDC4,#80CBC4,#80CBC4

@weotch
weotch / shopify.md
Last active June 3, 2016 22:29
Managing Shopify content

Here is a summary of different options that Shopify offers for managing content inclduing managing externally.

The config/settings_schema.json file lives in your theme and lets you define fields that are editable in the Storefront editor. These values can be used in css and js as well as the liquid files.

You can create a number of different field types:

@weotch
weotch / l5-packages.md
Last active August 29, 2015 14:27
Laravel 5 package development
  1. Install studio globally.
  2. Tweak the generated autoload stuff in vendor/autoload.php to put higher-level consumers at the start:
// @generated by Composer Studio (https://github.com/franzliedke/studio)

require_once __DIR__ . '/../workbench/decoy/vendor/autoload.php';
require_once __DIR__ . '/../workbench/upchuck/vendor/autoload.php';
require_once __DIR__ . '/../workbench/cloner/vendor/autoload.php';
require_once __DIR__ . '/../workbench/library/vendor/autoload.php';
@weotch
weotch / styles.less
Last active May 24, 2017 20:38
My hacks to atom material theme
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/
var root = this;
(function( jQuery ) {
if ( root.XDomainRequest ) {
jQuery.ajaxTransport(function( s ) {
if ( s.crossDomain && s.async ) {
if ( s.timeout ) {
s.xdrTimeout = s.timeout;
delete s.timeout;
}