Skip to content

Instantly share code, notes, and snippets.

View fokusferit's full-sized avatar
💭
I may be slow to respond.

Ferit Topcu fokusferit

💭
I may be slow to respond.
View GitHub Profile
@fokusferit
fokusferit / terminal-command.txt
Created March 26, 2018 09:57
License Checking
npm i -g license-checker
@fokusferit
fokusferit / browserMocks.js
Last active May 14, 2018 15:11
Add Testing Strategy to preact-cli
// Mocks localStorage
const localStorageMock = (function() {
let store = {};
return {
getItem: (key) => store[key] || null,
setItem: (key, value) => store[key] = value.toString(),
clear: () => store = {}
};
@fokusferit
fokusferit / enzyme_render_diffs.md
Last active June 18, 2024 11:27
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
var estraverse = require('estraverse');
var fs = require('fs');
fs.readFile('./ast.json', 'utf-8', function(err, ast) {
if(err) throw err;
const data = JSON.parse(ast);
estraverse.traverse(data, {
enter: function(node, parent) {
if(node.type === "Literal" && parent.type === "ArrayExpression") {
if(!Number.isInteger(node.value)){
@fokusferit
fokusferit / Sample AST
Last active January 13, 2017 14:43
A basic AST for a one line ES6 code
{
"type": "Program",
"start": 0,
"end": 23,
"body": [
{
"type": "VariableDeclaration",
"start": 0,
"end": 22,
"declarations": [
@fokusferit
fokusferit / simple AST creation
Last active January 13, 2017 14:44
Just a basic node script which saves the AST of JS code in a file.
var espree = require('espree');
var fs = require('fs');
var code = `let array = [1,2,'b'];
`;
var ast = espree.parse(code, {
ecmaVersion: 6
});
@fokusferit
fokusferit / frontendDevlopmentBookmarks.md
Created August 29, 2016 08:02 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="../../bower_components/paper-input/paper-input.html">
<dom-module id="ajax-multiple">
<template>
<section id="content">
<paper-input id="post" label="Post" value="{{title}}" on-blur="resolve">
</paper-input>
<link rel="import" href="https://cdn.rawgit.com/Download/polymer-cdn/master/lib/polymer/polymer.html" />
<link rel="import" href="https://cdn.rawgit.com/Download/polymer-cdn/master/lib/iron-ajax/iron-ajax.html" />
<dom-module id="ajax-element">
<template>
<iron-ajax
auto
url="https://jsonplaceholder.typicode.com/posts/1"
handle-as="json"