- vagrant plugin install vagrant-bindfs
- vagrant plugin install vagrant-vbguest
Before installing bindfs, we need to install FUSE with development package using yum:
- yum install fuse fuse-devel -y
In Grunt, this is how your can match filenames with multiple dots and write to filenames that contain the original dot sequence, except for file extension.
/path/to/module.somename.scss -> /path/to/module.somename.css
Insperienced by http://adam.merrifield.ca/2014/10/07/yeoman-angularjs-and-php/
php
import React, { Component, PropTypes } from 'react'; | |
export default class ImageInput extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
src: props.src ? props.src : null, | |
} | |
this.handleOnChange = this.handleOnChange.bind(this); |
The stuff in this gist sets up a Twig filter (obfuscate
) to create the obfuscated ids (for URLs), makes the obfuscator available as a service (id_obfuscator
) so you can also generate obfuscated URLs in your controllers or whatever, and extends the DoctrineParamConverter to allow it to retrieve entities by their deobfuscated id.
Following Phil Sturgeon's excellent advice in Build APIs You Won't Hate, I've also added an option to allow multiple ids to be loaded at once, like /resources/id1,id2,id3,id4
. It's really quite handy sometimes. Bewarned though; it won't
On a clean Rails 4 install with Bundler 1.3.0, using --binstubs causes competition between Rails and Bundler for the contents of bin/rails (and bin/rake).
Just running bundle
will rewrite the Rails version of bin/rails to a version that doesn't work.
The fix is to use the new bundle binstubs <gemname>
command.
(see rails/rails#8974)
// it require either lodash or underscorejs | |
.config(function(RestangularProvider) { | |
// add a response interceptor | |
RestangularProvider.addResponseInterceptor(function(data, operation, what, url, response, deferred) { | |
extractedData = data.data; | |
extractedData.meta = data.meta; | |
extractedData.included = data.included; | |
function _apply(elem, fct){ |
window.ParsleyConfig = { | |
validators: { | |
cpf: { | |
fn : function ( val, req) { | |
val = $.trim(val); | |
val = val.replace('.',''); | |
val = val.replace('.',''); | |
cpf = val.replace('-',''); | |
while(cpf.length < 11) cpf = "0"+ cpf; |
// addon/services/ajax.js | |
// ensure custom ajax requests have the appropriate authorization headers when signed in | |
import Ember from 'ember'; | |
import AjaxService from 'ember-ajax/services/ajax'; | |
const { | |
computed, | |
inject, | |
get | |
} = Ember; |
class Organisation < ApplicationRecord | |
NUMBER_OF_PERMITTED_USERS = 10 | |
has_many :users, before_add: :validate_user_limit | |
private | |
def validate_user_limit(user) | |
raise Exception.new if users.size >= NUMBER_OF_PERMITTED_USERS | |
end | |
end |