Skip to content

Instantly share code, notes, and snippets.

@srinionline
srinionline / expect.js
Created January 11, 2023 16:02
Techstrology-Test suite failed to run
import toDos from '../Store/ConfigureStore';
const stateBefore = [];
const action = {
type: 'ADD_TODO',
id: 0,
text: 'Learn Redux'
}
const stateAfter = [
{
@srinionline
srinionline / todo.test.js
Created January 11, 2023 16:01
Techstrology-Test suite failed to run
import toDos from '../Store/ConfigureStore';
const stateBefore = [];
const action = {
type: 'ADD_TODO',
id: 0,
text: 'Learn Redux'
}
const stateAfter = [
{
@srinionline
srinionline / SelectLanguage.js
Created January 11, 2023 15:51
Techstrology- How to pass data from child component
import React from 'react';
// var json = require("../passChildToParent/languages.json");
var jsonArray = [
{
"code": "aaa",
"lang": "english"
},
{
"code": "aab",
@srinionline
srinionline / render.js
Created January 11, 2023 15:49
Techstrology- How to pass data from child component
handleLangChange = () => {
var lang = this.myRef.current.value;
this.props.onSelectLanguage(lang);
}
@srinionline
srinionline / CreateRef.js
Created January 11, 2023 15:48
Techstrology- How to pass data from child component
constructor() {
super();
this.myRef = React.createRef();
}
render() {
return (
<div>
<h5>Child Component : </h5>
<select ref={this.myRef} onChange={this.handleLangChange}>
<option selected='true'>--select-launguage--</option>
@srinionline
srinionline / UpdatedParentComponent.js
Created January 11, 2023 15:46
Techstrology- How to pass data from child component
import React from 'react';
import SelectLanguage from './SelectLanguage';
export default class ParentComponent extends React.Component {
state = {
language: '--select-launguage--',
};
handleLanguage = (langValue) => {
debugger
@srinionline
srinionline / ChildComponent.js
Last active January 11, 2023 15:44
Techstrology- How to pass data from child component
render() {
return (
<div className="col-sm-4">
<br></br>
<h4 > Parent Component: </h4> {this.state.language}
<hr></hr>
<div >
<SelectLanguage onSelectLanguage={this.handleLanguage} />
</div>
@srinionline
srinionline / approach7.cs
Created January 11, 2023 15:12
Techstrology-Check the string contains
using System;
class Program
{
static void Main(string[] args)
{
string str = "`~@raked ";
string replaceChar = "%20";
string output = hasSpecialChar(str, replaceChar);
Console.WriteLine(output);
}
@srinionline
srinionline / approach6.cs
Created January 11, 2023 15:10
Techstrology-Check the string contains
using System;
class Program
{
static void Main(string[] args)
{
string str = "`~@raked";
bool flag = hasSpecialChar(str);
if (flag)
{
Console.WriteLine("Yes");
@srinionline
srinionline / approach5.cs
Created January 11, 2023 13:07
Techstrology-Check the string contains
using System;
using System.Linq;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the Chars");
char[] chars = Console.ReadLine().ToCharArray();