Skip to content

Instantly share code, notes, and snippets.

@benfoley
benfoley / Capistrano3 Unicorn Rbenv Ruby Nginx test app
Last active September 26, 2016 23:47
Config files for a Capistrano3 Unicorn Rbenv Ruby Nginx test app
Sample files for a basic Unicorn Capistrano3 setup - like something for DigitalOcean
Set up a user deploy, in new group deployers
@benfoley
benfoley / Ionic2 Angular2 animations
Last active October 7, 2016 06:15
Ionic2 Angular2 animations
Start a new ionic 2 project
> https://ionicframework.com/docs/v2/cli/
```
ionic start animationTest --v2
```
Replace content in home files with below..
```
@benfoley
benfoley / install dragula for ionic2rc0.md
Last active October 10, 2016 03:41
Getting dragula to work with Ionic2 RC0

Getting dragula to work with Ionic2 RC0

Install Dragula

npm install dragula --save

Install Dragula typings

npm install @types/dragula --save
@benfoley
benfoley / set a bag limit of 1 for ionic2 rc0 dragula.md
Last active October 10, 2016 04:13
ionic2 rc0 dragula bag limit 1

Set up dragula as per the other gist.

When something is dropped, we clear the target's children and then re-append the dropped element.

Should do this more Angular-ey, but ok for now.

@benfoley
benfoley / angular2 ViewChild ViewChildren.md
Created October 10, 2016 04:09
Angular2 ViewChild ViewChildren

Access DOM elements with Angular2's ViewChild and ViewChildren. I know it's not the preferred way, but sometimes handy.

Add a #label to the element in html.

Access that in the component by setting queries in the component decorator.

Then after the view is initialised we can get the nativeElement.

ViewChildren gives us a QueryList. The children aren't accessed directly through that, but we can filter/map/foreach that to get to the elements.

@benfoley
benfoley / home.ts
Created July 20, 2017 03:32
Trying to play audio with Ionic Native Media plugin
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { File } from '@ionic-native/file';
import { Media, MediaObject } from '@ionic-native/media';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@benfoley
benfoley / elpis-deploy.sh
Last active November 28, 2019 00:26 — forked from fauxneticien/elpis-deploy.sh
Elpis deploy script for ICLDC workshop
#!/bin/bash
# Commands taken from https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04
# Run using:
# bash <(curl -s https://gist.githubusercontent.com/fauxneticien/159529bf6c071f90b7fd70a481e6083b/raw/47c1d9e7c922797deee9fa2ce16387d6a3ed3624/elpis-deploy.sh)
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
# added new lines for containerd
@benfoley
benfoley / Brewfile
Created May 7, 2021 04:10 — forked from ryanhanwu/Brewfile
New Mac Setup Script 2021
# Taps
tap 'homebrew/cask-fonts'
tap 'homebrew/cask-versions'
tap 'heroku/brew'
# Install CLI Tools
## Shell Utilities
brew 'coreutils'
brew 'findutils'
brew 'autojump'
@benfoley
benfoley / gcp-gpu-elpis-install.sh
Last active July 26, 2021 01:50
Google Cloud Platform GPU installation steps for Elpis
# Install gpu drivers
sudo apt install linux-headers-$(uname -r)
curl -O https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
sudo apt update
sudo apt -y install cuda
# Install docker instructions from https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html