Skip to content

Instantly share code, notes, and snippets.

@leocristofani
leocristofani / RFReactSelect.js
Last active June 8, 2020 14:59
How to integrate React Select with Redux Form
import React, { PropTypes } from 'react';
import Select from 'react-select';
import 'react-select/dist/react-select.css';
RFReactSelect.defaultProps = {
multi: false,
className: ""
};
RFReactSelect.propTypes = {
var Col = require('react-bootstrap/lib/Col')
var PageHeader = require('react-bootstrap/lib/PageHeader')
var React = require('react')
var Row = require('react-bootstrap/lib/Row')
var {connect} = require('react-redux')
var {reduxForm} = require('redux-form')
var DateInput = require('./DateInput')
var FormField = require('./FormField')
var LoadingButton = require('./LoadingButton')
# Respond to incoming requests.
sub vcl_recv {
# Use anonymous, cached pages if all backends are down.
if (!req.backend.healthy) {
unset req.http.Cookie;
}
# Allow the backend to serve up stale content if it is responding slowly.
set req.grace = 6h;
(function ($) {
Drupal.behaviors.menuTree = {
attach: function (context, settings) {
// Set ul depths for better theming.
$('#main-menu ul').each(function () {
var depth = $(this).parents('ul').length;
$(this).addClass('ul-depth-' + depth);
});
// Set ul > li depths for better theming.
@coreymcmahon
coreymcmahon / PostControllerTest.php
Last active August 31, 2017 00:51
Building Testable Applications using the Repository Pattern - http://www.slashnode.com/the-repository-pattern/
<?php
use Acme\Storage\PostRepositoryInterface;
use Mockery as m;
class PostControllerTest extends TestCase {
private $postRepository;
public function setUp()
# A drupal varnish config file for varnish 3.x
#
# Will work with Drupal 7 and Pressflow 6.
#
# Default backend definition. Set this to point to your content
# server. We are assuming you have a web server running on port 8080.
#
C{
#include <sys/time.h>
#include <stdio.h>
@juampynr
juampynr / mymodule.info
Last active June 9, 2023 21:53
Drupal 7 Views 3 custom field handler
dependencies[] = ctools
; Views Handlers
files[] = views/mymodule_handler_handlername.inc
@abhrp
abhrp / showhide.html
Created May 3, 2013 10:38
AngularJS examples for ng-show and ng-hide toggle elements.
<!doctype html>
<head>
<title>AngularJS: ng-show and ng-hide example</title>
</head>
<body ng-app="NgHideShowApp">
<div ng-controller="AppCtrl">
<div>
<input type="checkbox" ng-model="showText">Change Text
<br>
<div ng-show="showText">
@JeffreyWay
JeffreyWay / BaseModel.php
Last active March 1, 2020 07:14
To make for clean and readable tests, do your mocking in a base model that your Eloquent models extend.
<?php
class BaseModel extends Eloquent {
public static function shouldReceive()
{
$repo = get_called_class() . 'RepositoryInterface';
$mock = Mockery::mock($repo);
App::instance($repo, $mock);
@benclark
benclark / default.vcl
Created May 14, 2012 17:17
Varnish config file w/ basic auth
backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
}
acl purge {
"localhost";