Skip to content

Instantly share code, notes, and snippets.

@psdcoder
psdcoder / index.js
Created January 23, 2019 15:31
Fragment generator
function pad(lvl) {
return ' '.repeat(2 * lvl);
}
function buildGraphStructure(data, lvl = 0) {
return Object.keys(data).reduce((acc, key) => {
if (data[key]) {
return (
acc +
`${pad(lvl)}${key} {\n` +

Keybase proof

I hereby claim:

  • I am psdcoder on github.
  • I am psdcoder (https://keybase.io/psdcoder) on keybase.
  • I have a public key ASAWIbcPbJjxBuE3DFILkJM9Ufr_ejNbFJfFgYHLVYeFLAo

To claim this, I am signing this object:

@psdcoder
psdcoder / watchers.js
Created July 15, 2015 10:59
Get count of angularjs watchers
//from https://medium.com/@kentcdodds/counting-angularjs-watchers-11c5134dc2ef
function getWatchers(root) {
root = angular.element(root || document.documentElement);
var watcherCount = 0;
function getElemWatchers(element) {
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope);
var scopeWatchers = getWatchersFromScope(element.data().$scope);
var watchers = scopeWatchers.concat(isolateWatchers);
<!DOCTYPE html>
<html>
<head>
<script src="http://static.jsbin.com/js/vendor/traceur.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:600' rel='stylesheet' type='text/css'>
<style id="jsbin-css">
@font-face {
font-family: 'icomoon';
@psdcoder
psdcoder / ng:config
Created February 20, 2015 12:20
Angular webstorm live templates
(function () {
'use strict';
angular
.module('$MODULE_NAME$')
.config($COMPONENT$Initialization);
function $COMPONENT$Initialization() {
$END$
}
@psdcoder
psdcoder / angular-transclude-scope.js
Created September 10, 2014 10:31
Bind transcluded dom to directive scope
<!DOCTYPE html>
<html ng-app="app">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
</head>
<body ng-controller="ParentCtrl">
<test-directive>
<p>Some content <br> {{ test }} </p>
</test-directive>
<script>
@psdcoder
psdcoder / angular-popups
Created August 28, 2014 16:14
angular setup for popups (with particular route (state) and on open different state (onEnter callback))
<!DOCTYPE html>
<html ng-app="app">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular-route.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.10/angular-ui-router.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
@psdcoder
psdcoder / node-js-inheritance
Created August 27, 2014 20:37
node js inheritance of classes
var util = require('util');
function BaseClass(data) {
if (!data) {
throw new TypeError('You must pass "data" in constructor');
}
console.log('base constructor');
this.data = data;
}
@psdcoder
psdcoder / setting-up-xdebug.md
Last active August 29, 2015 13:58
Setting up of Xdebug in PHPStorm
  1. Installing and setting up xdebug: http://www.xdebug.org/wizard.php
  2. Add to php.ini:
    [XDebug]
    zend_extension="path to xdebug.so"
    xdebug.remote_autostart=on
    xdebug.remote_enable=on
    xdebug.remote_handler="dbgp"
    xdebug.remote_host="localhost"
    xdebug.remote_port=9000
    xdebug.remote_mode=req