- https://speakerdeck.com/willroth/50-laravel-tricks-in-50-minutes
- https://www.reddit.com/r/laravel/comments/3to60i/50_laravel_tricks/
- 1. Automatic Model Validation
import React from "react" | |
import { Route, Switch } from "react-router-dom" | |
const AppRoute = ({ component: Component, layout: Layout, ...rest }) => ( | |
<Route {...rest} render={props => ( | |
<Layout> | |
<Component {...props} /> | |
</Layout> | |
)} /> | |
) |
//== Media queries breakpoints | |
// Extra small screen / phone | |
$screen-xs: 480px; | |
$screen-xs-min: $screen-xs; | |
// Small screen / tablet | |
$screen-sm: 768px; | |
$screen-sm-min: $screen-sm; |
/** | |
* Changes XML to JSON | |
* Modified version from here: http://davidwalsh.name/convert-xml-json | |
* @param {string} xml XML DOM tree | |
*/ | |
function xmlToJson(xml) { | |
// Create the return object | |
var obj = {}; | |
if (xml.nodeType == 1) { |
'use strict'; | |
/** | |
* @ngdoc directive | |
* @name myapp.directive:forceLowerCase | |
* @description | |
* # forceLowerCase | |
*/ | |
angular.module('myapp') | |
.directive('forceLowerCase', function ($parse) { |
I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)
<?php | |
/** | |
* Create a web friendly URL slug from a string. | |
* | |
* Although supported, transliteration is discouraged because | |
* 1) most web browsers support UTF-8 characters in URLs | |
* 2) transliteration causes a loss of information | |
* | |
* @author Sean Murphy <sean@iamseanmurphy.com> | |
* @copyright Copyright 2012 Sean Murphy. All rights reserved. |
/** | |
* A function to take a string written in dot notation style, and use it to | |
* find a nested object property inside of an object. | |
* | |
* Useful in a plugin or module that accepts a JSON array of objects, but | |
* you want to let the user specify where to find various bits of data | |
* inside of each custom object instead of forcing a standardized | |
* property list. | |
* | |
* @param String nested A dot notation style parameter reference (ie "urls.small") |
/* assumes .details is position: relative */ | |
.details::after { | |
content: ''; | |
position: absolute; | |
border-top: 3px solid #7f7f7f; | |
border-right: 3px solid #7f7f7f; | |
height: 6px; | |
width: 6px; | |
top: 50%; | |
right: 12px; |