Skip to content

Instantly share code, notes, and snippets.

View davinkevin's full-sized avatar
👋
Working hard !

Davin Kevin davinkevin

👋
Working hard !
View GitHub Profile
@davinkevin
davinkevin / CommunicationService.js
Last active November 26, 2015 04:46
AngularJS Rx replacement to $broadcast | $emit | $on
/**
* Created by kdavin on 24/11/2015.
*/
import {Service, Module} from '../../../decorators';
import Rx from 'rx';
@Module({
name : "app.common.services.communication"
})
@Service("CommunicationService")
@davinkevin
davinkevin / How long is a digest cycle ?
Last active December 14, 2016 12:25
Count the number of watchers in AngularJS 1 include in bookmarklet
javascript:(function() {
if (!angular) {
alert('Not a angular application or window.angular not found');
return;
}
var entryNode = document.querySelector('[ng-app]') || document.querySelector('.ng-scope');
if (!entryNode) {
alert('No entryPoint found');
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>{{ name }}</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.2.x" src="https://code.angularjs.org/1.2.16/angular.js" data-semver="1.2.16"></script>
<script src="app.js"></script>
<div class="panel panel-default widget">
<div class="panel-heading">
<span class="glyphicon glyphicon-comment"></span>
<h3 class="panel-title">Recent Comments</h3>
<span class="label label-info"></span>
</div>
<div class="panel-body">
<ul class="list-group">
<li class="list-group-item" >
.rating {
color: #a9a9a9;
margin: 0;
padding: 0;
}
ul.rating {
display: inline-block;
}
@davinkevin
davinkevin / restore.java
Created June 24, 2016 05:15
Method to restore database of H2 programmatically / in sql
@Transactional
public Boolean restore(String filename, TimeUnit timeUnit, Integer during) {
Path restoreFile = backup.getLocation().resolve(filename);
if (!Files.exists(restoreFile))
return Boolean.FALSE;
log.info("Full database reset");
em.createNativeQuery("DROP ALL OBJECTS;").executeUpdate();
javascript:(function () { if (!angular) { alert('Not a angular application or window.angular not found'); return; } var root = angular.element(document.getElementsByTagName('body')); var watchers = []; var f = function (element) { angular.forEach(['$scope', '$isolateScope'], function (scopeProperty) { if (element.data() && element.data().hasOwnProperty(scopeProperty)) { angular.forEach(element.data()[scopeProperty].$$watchers, function (watcher) { watchers.push(watcher); }); } }); angular.forEach(element.children(), function (childElement) { f(angular.element(childElement)); }); }; f(root); var watchersWithoutDuplicates = []; angular.forEach(watchers, function(item) { if(watchersWithoutDuplicates.indexOf(item) < 0) { watchersWithoutDuplicates.push(item); } }); alert('There is ' + watchersWithoutDuplicates.length + ' watcher
@davinkevin
davinkevin / error.js
Created July 10, 2016 10:48
Error generated by vget parsing function
This file has been truncated, but you can view the full file.
var _yt_player={};(function(g){var window=this;var h,p,q,r,ca,da,ea,fa,v,ga,ha,ia,ka,na,oa,pa,w,qa,ra,y,sa,va,wa,A,xa,ya,Ga,Ka,Ha,Ia,Ma,Na,Pa,B,Qa,Ra,Ua,Ta,Va,Xa,Ya,Za,$a,ab,bb,db,fb,eb,ib,gb,kb,lb,nb,ob,qb,pb,rb,sb,tb,ub,wb,vb,xb,Ab,Bb,yb,Cb,Db,Eb,Gb,zb,Fb,Hb,Ib,Jb,Kb,Lb,Mb,E,F,Nb,Ob,Pb,Qb,Rb,Sb,Tb,Ub,Vb,Xb,Yb,Zb,$b,ac,Wb,bc,cc,dc,ec,fc,gc,hc,ic,jc,lc,mc,oc,pc,qc,sc,tc,uc,vc,yc,Ac,Dc,Ec,Gc,Jc,Kc,Lc,Nc,Oc,Pc,Qc,Mc,Rc,Tc,Wc,ad,bd,cd,Xc,fd,ed,Zc,Uc,Sc,I,hd,id,jd,kd,ld,md,pd,od,qd,rd,xd,td,yd,zd,Ad,Cd,Dd,Fd,Gd,Hd,Jd,Kd,Md,Od,Pd,Td,Nd,Bd,Id,Wd,Sd,
Qd,Rd,Xd,Vd,Ud,Ld,Zd,$d,ae,be,ce,de,ee,fe,J,ge,ie,je,K,le,re,te,ue,ve,ye,ze,Be,Ce,Fe,Ee,He,Ie,Je,Le,Me,Oe,Ne,Ve,We,Xe,Ye,Ze,af,bf,cf,df,ef,ff,gf,lf,nf,of,mf,qf,rf,uf,sf,vf,L,wf,yf,Af,Bf,Cf,Df,Ef,Ff,Gf,If,Kf,Jf,Mf,Nf,jf,Of,Pf,Qf,Tf,Rf,Sf,zf,Vf,Wf,Uf,hf,Xf,Yf,Zf,bg,ag,$f,cg,dg,gg,hg,ig,kg,lg,mg,ng,og,pg,qg,sg,tg,ug,vg,xg,yg,zg,wg,Ag,Bg,Cg,Dg,Fg,Gg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg,Sg,Tg,Ug,Wg,Xg,Zg,$g,M,ah,bh,ch,dh,eh,kh,mh,nh,oh,ph,fh,ih,qh,gh,sh,rh,uh,lh,th,hh,vh,xh,yh,zh,A
@davinkevin
davinkevin / ffprobe.help.txt
Created July 25, 2016 02:37
ffprobe.help.txt
Simple multimedia streams analyzer
usage: ffprobe [OPTIONS] [INPUT_FILE]
Main options:
-L show license
-h topic show help
-? topic show help
-help topic show help
--help topic show help
-version show version
@davinkevin
davinkevin / ng.fish
Created October 19, 2016 05:27
angular-cli autocomplete
# ng help
complete -f -c ng -n '__fish_use_subcommand' -a help -d 'Outputs the usage instructions for all commands or the provided command.'
# ng version
complete -f -c ng -n '__fish_use_subcommand' -a version -d 'Outputs angular-cli version.'
complete -f -A -c ng -n '__fish_seen_subcommand_from version' -l verbose -d 'verbose (Boolean) (Default: false)'