Skip to content

Instantly share code, notes, and snippets.

View cyrilpanicker's full-sized avatar

Cyril Panicker cyrilpanicker

View GitHub Profile
@cyrilpanicker
cyrilpanicker / javascript-questions.txt
Created April 21, 2016 07:06
basic questions on javascript, jquery and angularjs
------------------
-What are closures?
-How can you create a class in javascript?
-What is prototypal inheritance?
-i have a function which is already a method of a class. i want to use that function on an object of another class / what is apply/call function?
-apply/call/bind functions
-can we do multithreading in javascript as in other languages?
-why do you need promises in javascript? can we do the same thing with callbacks? why do we prefer promises over callback?
----------------
(function() {
@cyrilpanicker
cyrilpanicker / DOM traversal in Angular directive.markdown
Created June 28, 2015 16:43
DOM traversal in Angular directive
@cyrilpanicker
cyrilpanicker / create_launcher
Last active August 29, 2015 14:21
linux_ubuntu_recipes
- use below as skeleton to create a .desktop file
- name of the file is irrelevant.
[Desktop Entry]
Name=Android Studio
Comment=Android IDE
Exec=/usr/local/bin/studio
Icon=/home/cyril/Softwares/android-studio/bin/studio.png
Terminal=false
Type=Application
@cyrilpanicker
cyrilpanicker / promise.js
Last active August 29, 2015 14:08
using promise api
var Promise=require('bluebird');
var addOneAsync=function (number) {
return new Promise(function (resolve,reject) {
setTimeout(function() {
console.log('addOneAsync called');
if (number<=0 || number >20) {
reject('number should be between 1 and 20');
} else {
resolve(number+1);
@cyrilpanicker
cyrilpanicker / constructor_vs_prototype.js
Last active August 29, 2015 14:07
prototypal inheritance
function Test () {
var privateVariable=0;
this.publicVariable=0;
this.setPrivate=function (value) {
privateVariable=value;
};
this.getPrivate=function () {
@cyrilpanicker
cyrilpanicker / custom-validation-using-ui-validate-directive.markdown
Last active August 29, 2015 14:06
custom validation using ui-validate directive
@cyrilpanicker
cyrilpanicker / controller-demo.markdown
Last active August 29, 2015 14:06
controller demo
@cyrilpanicker
cyrilpanicker / index.html
Last active August 29, 2015 14:06
lifecycle and dependency resolution
<div ng-app="app">
</div>
@cyrilpanicker
cyrilpanicker / index.html
Last active August 29, 2015 14:06
validation and parsing using custom directive
<form name="form" ng-controller="controller" novalidate ng-app="app">
<input ng-model="data.value" name="number" integer /><br/>
{{data}}<br/>
{{form.number.$error}}
</form>