Skip to content

Instantly share code, notes, and snippets.

View danmatthews's full-sized avatar
😃
Working.

Dan Matthews danmatthews

😃
Working.
View GitHub Profile

Our new URL based modal system allows you to do two things:

  1. Open a modal using Inertia's router using query params using a given key.
  2. Add prefixed "state" parameters to the URL that clear when the modal is closed.

A quick example.

To open a modal when the registration key is present in the URL, do the following:

// Add this to your 'plugins' array in your tailwind config file.
// This creates classes suffixed with an opacity level for each bg colour
// For example, .bg-red would have .bg-red-10 through .bg-red-100 for 0.10% opacity background and 100% opacity respectively.
({addUtilities, config}) => {
let colors = config('colors', []);
const newColors = {};
let hexToRgb = (hex) => {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
@danmatthews
danmatthews / NativeService.js
Created February 5, 2016 18:19
Native Service
MyApp.factory('NativeService', [function(){
return {
run: function(nativeCallback, browserCallback) {
var dev = ionic.Platform.device();
if ('available' in dev) {
nativeCallback();
} else {
browserCallback();
}
(function(){var t,e,n,r,i,o,s,a,l,u,f,h,c,p,m,d,g,y,v,b,w,x,M,k,S,T,C,F,H,R,q,X,Y,j,z,I,A,G,V,Z,E,O,L,D,P,W,N,$,B,U,K,J,Q,_,te,ee,ne=function(t,e){return function(){return t.apply(e,arguments)}};H=function(){return"visible"===document.visibilityState||null!=T.tests},j=function(){var t;return t=[],"undefined"!=typeof document&&null!==document&&document.addEventListener("visibilitychange",function(){var e,n,r,i;for(i=[],n=0,r=t.length;r>n;n++)e=t[n],i.push(e(H()));return i}),function(e){return t.push(e)}}(),x=function(t){var e,n,r;n={};for(e in t)r=t[e],n[e]=r;return n},b=function(t){var e;return e={},function(){var n,r,i,o,s;for(r="",o=0,s=arguments.length;s>o;o++)n=arguments[o],r+=n.toString()+",";return i=e[r],i||(e[r]=i=t.apply(this,arguments)),i}},Y=function(t){return function(e){var n,r,i;return e instanceof Array||e instanceof NodeList||e instanceof HTMLCollection?i=function(){var i,o,s;for(s=[],r=i=0,o=e.length;o>=0?o>i:i>o;r=o>=0?++i:--i)n=Array.prototype.slice.call(arguments,1),n.splice(0,0,e[r]),s.pu
#! /usr/bin/env bash
# Change to your home dir.
cd ~/
if [ -a /usr/local/bin/composer ]; then
echo "You already have composer"
composerpath='composer'
else
# Get the composer.phar file.
curl -S http://getcomposer.org/installer | php

Discussion: Getting started with client-side applications.

Note: While my stack consists of Laravel (4/5) and AngularJS, i don't want this discussion to become a language or framework flame war, let's keep it respectable.

I would love the result of this to become an incredibly helpful blog post & guide.

Hi guys, i'm currently in the throes of (among other things), writing a client-side application to interact with an API (that i control). And there's a few things that confuse me, and i'd love to start an open discussion on the best patterns to use when building client side applications in order to achieve some of the following:

Securely authenticating users.

### Install OpenJDK
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Download and Install ElasticSearch
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.1.deb
sudo dpkg -i elasticsearch-1.3.1.deb
sudo -s
# Update Aptitude
sudo apt-get update
# Install Java
sudo apt-get install openjdk-7-jre-headless -y
# Download and install Elasticsearch Public Signing Key
sudo wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -
Feature: Log into my website.
Scenario: I want to successfully log in to my website.
Given I am on "/user"
And I fill in "name" with "{{username}}"
And I fill in "pass" with "{{password}}"
When I press "Log in"
Then url should match "/user"