Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Ferit Topcu fokusferit

I may be slow to respond.
View GitHub Profile
View Making an iron-ajax call
<link rel="import" href="" />
<link rel="import" href="" />
<dom-module id="ajax-element">
View Iron-ajax to make ajax calls to different URL endpoints
<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">
<section id="content">
<paper-input id="post" label="Post" value="{{title}}" on-blur="resolve">
fokusferit /
Created Aug 29, 2016 — forked from dypsilon/
A badass list of frontend development resources I collected over time.
fokusferit / simple AST creation
Last active Jan 13, 2017
Just a basic node script which saves the AST of JS code in a file.
View simple AST creation
var espree = require('espree');
var fs = require('fs');
var code = `let array = [1,2,'b'];
var ast = espree.parse(code, {
ecmaVersion: 6
fokusferit / Sample AST
Last active Jan 13, 2017
A basic AST for a one line ES6 code
View Sample AST
"type": "Program",
"start": 0,
"end": 23,
"body": [
"type": "VariableDeclaration",
"start": 0,
"end": 22,
"declarations": [
View Sample traversal of Espree AST
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") {
fokusferit /
Last active Nov 23, 2022
Difference between Shallow, Mount and render of Enzyme


Real unit test (isolation, no children render)

Simple shallow


  • constructor
  • render
fokusferit / browserMocks.js
Last active May 14, 2018
Add Testing Strategy to preact-cli
View browserMocks.js
// Mocks localStorage
const localStorageMock = (function() {
let store = {};
return {
getItem: (key) => store[key] || null,
setItem: (key, value) => store[key] = value.toString(),
clear: () => store = {}