Skip to content

Instantly share code, notes, and snippets.

@wpscholar
wpscholar / vagrant-cheat-sheet.md
Last active November 11, 2024 15:23
Vagrant Cheat Sheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@GE-N
GE-N / uitextfield-placeholder-color.swift
Last active May 20, 2016 13:57
Change UITextField's placeholder text colour
extension UITextField {
public override func drawPlaceholderInRect(rect: CGRect) {
let newColor = UIColor(white: 1, alpha: 0.4)
let range = NSMakeRange(0, self.attributedPlaceholder!.length)
var mutatedAttributedPlaceholder = NSMutableAttributedString(attributedString: self.attributedPlaceholder!)
mutatedAttributedPlaceholder.setAttributes([ NSForegroundColorAttributeName : newColor ], range: range)
self.attributedPlaceholder = mutatedAttributedPlaceholder
super.drawPlaceholderInRect(rect)
@webarthur
webarthur / pure-slidedown-slideup.css
Last active December 18, 2023 07:47
Pure CSS slidedown / slideup animation using transform translateY
.slide-up, .slide-down {
overflow:hidden;
}
.slide-up > div, .slide-down > div {
transform: translateY(-100%);
transition: .4s ease-in-out;
}
.slide-down > div {
transform: translateY(0);
}
@christiaan-lombard
christiaan-lombard / mutate.directive.ts
Created February 10, 2017 09:26
Date Mutator - Angular 2 ControlValueAccessor
import { Directive, ElementRef, Input, Host, forwardRef, HostListener, Renderer, SimpleChanges } from '@angular/core';
import { NgModel, ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import * as moment from 'moment';
const MUTATE_VALUE_ACCESSOR_PROVIDER = [
{provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => MutateDirective), multi: true}
];
@Directive({
@jeffochoa
jeffochoa / Errors.js
Last active February 9, 2022 09:52
Vue Form and Error validator (Laracasts)
class Errors {
/**
* Create a new Errors instance.
*/
constructor() {
this.errors = {};
}
/**
@meigwilym
meigwilym / index.md
Created November 28, 2019 08:52
Notes on stitcher.io's Laravel beyond CRUD

Laravel beyond CRUD

stitcher.io

A blog series for PHP developers working on larger-than-average Laravel projects

Written for projects with a development lifespan of six to twelve months, with a team of three to six developers working on them simultaneously.

Chapter 1: Domain oriented Laravel