Skip to content

Instantly share code, notes, and snippets.

View elvan's full-sized avatar

Elvan Hidayat elvan

View GitHub Profile
@elvan
elvan / FeatureContext.php
Created March 6, 2012 14:04
Mink Context for Yii application.
<?php
use Behat\Behat\Context\ClosuredContextInterface;
use Behat\Behat\Context\TranslatedContextInterface;
use Behat\Behat\Context\BehatContext;
use Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Behat\Mink\Behat\Context\MinkContext;
@elvan
elvan / SpringExampleBuild.scala
Created April 2, 2012 11:47
Example of SBT build file for Spring application
import sbt._
import Keys._
object SpringExampleBuild extends Build {
private val springVersion = "3.1.1.RELEASE"
private val slf4jVersion = "1.6.4"
val exampleSettings = Seq(
name := "SpringExample",
version := "1.0-SNAPSHOT",
@elvan
elvan / FeatureContext.php
Created October 24, 2012 19:51
Example of Behat feature context for Zend Framework 2 application
<?php
use Behat\Behat\Context\Step\Given;
use Behat\Behat\Context\Step\Then;
use Behat\Behat\Context\Step\When;
use Behat\Behat\Event\SuiteEvent;
use Behat\Gherkin\Node\TableNode;
use Behat\MinkExtension\Context\MinkContext;
use Zend\Db\Adapter\Adapter;
@elvan
elvan / HomeController.java
Last active September 21, 2017 02:26
Spring MVC + Thymeleaf starter project
package org.example.blog.app.main;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping("/")
public class HomeController {
@elvan
elvan / auth_providers.dart
Created November 24, 2020 04:20
Flutter Riverpod and Firebase Auth example
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final firebaseAuthProvider = Provider<FirebaseAuth>((ref) {
return FirebaseAuth.instance;
});
final authStateChangesProvider = StreamProvider<User>((ref) {
return ref.watch(firebaseAuthProvider).authStateChanges();
});
@elvan
elvan / number-method-chaining.js
Created December 25, 2021 16:19
Method chaining for numbers without polluting prototype
function MyNumber(n) {
var internal = Number(n);
this.multiply = function(n) {
return internal * n
}
this.divide = function(n) {
return internal / n
}
@elvan
elvan / jsconfig.json
Last active April 2, 2023 07:22
An example of jsconfig.json for React projects
{
"compilerOptions": {
"checkJs": false,
"jsx": "react",
"module": "UMD",
"moduleResolution": "nodenext",
"target": "es6",
},
"include": [
"src/**/*"