Skip to content

Instantly share code, notes, and snippets.

Pratik Shah pratik14

Block or report user

Report or block pratik14

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pratik14
pratik14 / App.js
Created Sep 17, 2019
Testing react Formik forms with react-testing-library
View App.js
import React from "react";
import { Formik, Form, Field, ErrorMessage } from "formik";
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
const App = () => (
<div>
<Formik
initialValues={{ email: "", date: "" }}
@pratik14
pratik14 / app.js
Created Oct 31, 2017
SImple React Redux Notification. Single notification at a time
View app.js
import React, { PureComponent } from 'react';
import NotificationContainer from './../../containers/notificationContainer';
class App extends PureComponent {
render() {
return (
<div>
<h1>Home</h1>
<NotificationContainer />
</div>
View Restrict By Role
(function(){
angular.module('AppName')
.directive('restrict', [function(){
return({
restrict: 'A',
prioriry: 100000,
scope: false,
link: function(scope, element, attr) {
var accessDenied = true;
var role_code = scope.user.role_code;
View hello_world
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
</head>
<body ng-app="myapp">
@pratik14
pratik14 / Device Trace for "undefined method `to_key' for :user:Symbol" This is the full trace for the "undefined method `to_key' for :user:Symbol", as written by rspec -v.
View Device Trace for "undefined method `to_key' for :user:Symbol"
Failure/Error: post :create, :user => @attr
NoMethodError:
undefined method `to_key' for :user:Symbol
# /Users/mdlima/.rvm/gems/ruby-1.8.7-p334@rails3/gems/devise-1.2.1/lib/devise/rails/warden_compat.rb:18:in `serialize'
# /Users/mdlima/.rvm/gems/ruby-1.8.7-p334@rails3/gems/warden-1.0.3/lib/warden/session_serializer.rb:25:in `store'
# /Users/mdlima/.rvm/gems/ruby-1.8.7-p334@rails3/gems/warden-1.0.3/lib/warden/proxy.rb:161:in `set_user'
# /Users/mdlima/.rvm/gems/ruby-1.8.7-p334@rails3/gems/devise-1.2.1/lib/devise/controllers/helpers.rb:116:in `sign_in'
# ./app/controllers/sessions_controller.rb:8:in `create'
# /Users/mdlima/.rvm/gems/ruby-1.8.7-p334@rails3/gems/actionpack-3.0.5/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
# /Users/mdlima/.rvm/gems/ruby-1.8.7-p334@rails3/gems/actionpack-3.0.5/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
You can’t perform that action at this time.