Skip to content

Instantly share code, notes, and snippets.

View apackin's full-sized avatar

Assaf Packin apackin

View GitHub Profile
import 'package:gql_exec/gql_exec.dart';
import "package:async/async.dart";
import 'package:gql/ast.dart';
import 'package:gql_dio_link/gql_dio_link.dart';
import 'package:gql_exec/gql_exec.dart' as gql_exec;
import 'package:gql_dio_link/gql_dio_link.dart';
/// A handler of Link Exceptions.
@apackin
apackin / App.jsx
Created July 17, 2020 19:15
App with useImperativeHandle
function App() {
const [text, setText] = useState("Fun");
const fancyRef = useRef();
const submitButton = () => {
setText(fancyRef.current.value);
};
return (
<div id="App">
@apackin
apackin / FancyTextSubmit.jsx
Last active July 17, 2020 19:28
FancyTextSubmit with input refocus
function FancyTextSubmit() {
const inputRef = useRef(null);
const onButtonClick = () => {
// `current` points to the mounted text input element
inputRef.current.focus();
};
return (
<div>
<input ref={inputRef} type="text" />
<button onClick={onButtonClick}>Focus the input</button>
@apackin
apackin / FancyTextSubmit.jsx
Last active July 17, 2020 18:48
FancyTextSubmit with forwardRef
const FancyTextSubmit = forwardRef(({ onClick }, ref) => (
<div>
<input ref={ref} type="text" />
<button onClick={onClick}>Submit</button>
</div>
));
@apackin
apackin / App.jsx
Last active July 17, 2020 18:34
App using forwardRef for FancyTextSubmit
function App() {
const [text, setText] = useState("Fun");
const fancyTextRef = useRef();
const submitButton = () => {
setText(fancyTextRef.current.value);
};
return (
<div id="App">
@apackin
apackin / FancyTextSubmit.jsx
Created July 17, 2020 18:25
FancyTextSubmit Basic
const FancyTextSubmit = () => (
<div>
<input type="text"/>
<button onClick={onClick}>Submit</button>
</div>
);
@apackin
apackin / cloudSettings
Last active February 25, 2021 00:12
VS code config: TypeScript + Php (PSalm) setup
{"lastUpload":"2021-02-25T00:12:27.745Z","extensionVersion":"v3.4.3"}
@apackin
apackin / Node.md
Created January 18, 2016 20:27
Node.js

Node.js

"A run time environment"

Node allows us to run javascript on OS instead of browser We need a server to create a website or webapp

###Server A program running on a computer somewhere that can communicate with clients

##Modules

@apackin
apackin / DataStructures.md
Last active January 13, 2016 18:44
Data Structures

##IV: Abstract Data Types & Data Structures: Storing data on memory{ Array Inserting elements in arrays are "expensive" Arrays have fixed sizes (need to find contiguous open space)

Linked list Every element also needs to store a reference to the next item in the list

ADTs vs DTs

@apackin
apackin / Methods.md
Last active January 13, 2016 14:54
Methods Descriptions

FUNCTIONS:

Bind (allows you to save the current value of a variable into your function for when it is called):

  var createFunctions = function(num){
  	var funcList = [];
  
  	for (var i = 0; i < num; i++) {
 funcList.push(function(x){return x;}.bind(this, i));