Skip to content

Instantly share code, notes, and snippets.

View nvanselow's full-sized avatar

Nick Vanselow nvanselow

  • MA
View GitHub Profile
@nvanselow
nvanselow / gist:3c6fe71bef68554b1bb0
Last active June 7, 2018 12:36 — forked from antonioribeiro/gist:96ce9675e5660c317bcc
Codeception, Laravel, and PhantomJS

You can use Codeception to test Javascript, like DOM manipulations and Ajax requests. Out of the box it can manipulate DOM elements but can't execute Javascript code, like most testing frameworks. But it gives you the option to use a WebDriver, to connect to a headless browser, and mimic a user browsing your website. It gives you some options: Selenium2, ZombieJS and, the easiest to configure, PhantomJS.

This article covers the installation and usage of PhantomJS, and assumes you are using Laravel Homestead, but it will work on any relatively new Debian based distro, like Ubuntu 14.04.

###Install PhantomJS

Just run those commands to install it:

sudo apt-get update
@nvanselow
nvanselow / gist:f00b890c921da937ddb6
Last active July 7, 2023 19:02
Installing Selenium on Laravel Homestead

Install Selenium and PhantomJS on Laravel Homestead

All commands are in the terminal.

  1. SSH into the Homestead Box - vagrant ssh from homestead directory
  2. Create a new folder for Selenium - mkdir selenium from the ~ directory
  3. Navigate to that folder - cd selenium
  4. Get Selenium - wget http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar *Note: This link comes from copying the link on http://docs.seleniumhq.org/download/
  5. Install Java - sudo apt-get install openjdk-7-jre-headless
@nvanselow
nvanselow / Build Android Binary.md
Last active April 22, 2022 14:19
Generate Android Signed APK File for Google Play with Ionic
  1. Navigate to the project folder

  2. In the command line run ionic build android --release

  3. Then in the command line run jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore platforms/android/build/outputs/apk/android-release-unsigned.apk alias_name

    Change "my-release-key.keystore" and "alias_name" to match your app. You may also need to change the name of the apk file.

    Also, after the build process in step 2, you should see the path to your release apk at the bottom of the output.

  4. The zipalign -v 4 platforms/android/build/outputs/apk/android-release-unsigned.apk MyApp.apk

You may need to change the name of the apk file. The signed apk will be in the main folder unless you specify a different folder.

@nvanselow
nvanselow / IonicFilePermissions.md
Last active June 16, 2016 14:54
Ionic and Xcode File Permissions and Code Signing Errors

##Ionic, EACCESS, File Permission, and Xcode signing

Recently, Ionic and Xcode 6 have not been playing nicely. I believe I have targeted the error to file permissions that are set when Ionic adds a platform.

I kept getting an Exit Code 1 error when I would try to build my iOS app. Running the following from the terminal from within the project directory solved the error.

sudo chmod -R a+rwx platforms

###Error During iOS App Archiving

@nvanselow
nvanselow / Ionic_iOS_Local_Development.md
Created September 29, 2015 00:32
Allow local development servers without http in an iOS Ionic app.

Allowing Local Development Server without HTTPS

New rules cause a Transport Security Error in XCode when trying to test an app using an emulator that connects to a localhost without an SSL certificate. You can add the following code to allow testing on a development server.

Add the following to the platforms/ios/yourappname/YourAppName-Info.plist file

<key>NSAppTransportSecurity</key>
    <dict>
 NSExceptionDomains
@nvanselow
nvanselow / Transfer_MySql_Database.md
Last active October 1, 2017 13:55
Transferring a MySql database

Warning: Doing the following will overwrite your database.

The following will allow you to use a sql dump to overwrite an existing database.

  1. If the file is gzipped, run gunzip name_of_file.sql.gz
  2. Copy the file to the server
  3. Replace the database with the sql dump. mysql -uusername –p database_name < file.sql
  4. On Laravel Homestead, this would be mysql -uhomestead -p homestead < file.sql

Or this if the above is outputting a bunch of help text:

@nvanselow
nvanselow / .eslintrc.json
Last active December 6, 2021 11:35
Linter for JSX and ES6
{
"env": {
"browser": true,
"node": true
},
"extends": "google",
"installedESLint": true,
"plugins": [
"react"
],
@nvanselow
nvanselow / database_cleaner.rb
Created July 13, 2016 18:29
Database cleaner config for capybara-webki
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
@nvanselow
nvanselow / fix_empty_homestead.md
Created February 1, 2017 03:29
Fix Empty Vagrant/Homestead Folder

Are the folders in your vagrant/homestead box empty after a forced comptuer restart while the VM was running?

Try: vagrant reload

@nvanselow
nvanselow / Android_No_License.md
Created February 5, 2017 01:40
Ionic won't let you build android app because license not accepted

Open android SDK tools at Users/user-name/Library/Android/sdk/tools/android and go through and accept new licenses and download updates.