Skip to content

Instantly share code, notes, and snippets.


Kevin nehalist

View GitHub Profile
View foo.tsx
const Child: FunctionComponent<{ someprop: number }> = () => {
return <>child</>
const Foo: FunctionComponent<{ fooprop: boolean }> = (props) => (
<Child {...props} />
// IDE properly complains since `someprop` is missing in props of Foo
View expose.ts
const CUSTOM_PROPS = 'custom:properties';
function Expose(target: object, key: string) {
let properties: string[] | undefined = Reflect.getMetadata(CUSTOM_PROPS, target);
if (! properties) {
properties = [];

I've always been a heavy IDE user - but for some things, like running tests, I still prefered a terminal. Recently I've played around with the in-IDE possibilities for testing and was pretty satisfied with them. Since Symfony ships with a kinda custom testing experience here's how to setup your IDE to test your Symfony applications with it - and additional features of testing within your IDE.

IDE configuration

After following the current Testing documentation it's mandatory to manually run ./bin/phpunit once in your terminal. Symfony will install its own instance of PHPUnit within your bin directory which will provide the executable phpunit file for our IDE.

After you've run this command you'll see a .phpunit directory within your bin directory.

For being able to run your tests via your IDE open your Settings window and navigate to Languages & Frameworks > PHP > Test Frameworks.

View gist:06bd8b0ba8887a5f86272fb98a8ffbc4
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH=/home/kh/.npm-global/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/home/kh/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
View DefaultController.php
class DefaultController extends Controller
* @Route("/", name="homepage")
public function indexAction(Request $request)
View ts
import {ConfigurationLoaderInterface} from "./ConfigurationLoaderInterface";
export class JsonConfigurationLoader implements ConfigurationLoaderInterface {
handle(file: string): Object {
return require(file);
View gist:25b99b9d7a6a6b9730151d503f67c46b
// config.xml
View gist:6eea5c076d187d785d6c6486f5174c32
module.exports = function(grunt) {
grunt.config.set('ts', {
assets: {
files: [
expand: true,
cwd: 'assets/js/',
src: [
View models.js
// models/Project.js
module.exports = {
attributes: {
title: {
type: Sequelize.STRING
associations: function() {
# service
@app.factory 'CurrentUser', ($http) ->
method: 'GET',
url: 'users/me'
}).then (user) =>
# i want to return the user object
return # ... what?