Skip to content

Instantly share code, notes, and snippets.

View abrjagad's full-sized avatar

Abraham Jagadeesh abrjagad

View GitHub Profile
@abrjagad
abrjagad / &.js
Last active November 16, 2015 15:38
isolated scopes.
//
angular.module("MyApp", [])
.controller("MathCtrl", function($scope) {
$scope.add = function(x, y) {
return x + y;
};
})
.directive("myAddThings", function() {
return {
restrict: "E",
@abrjagad
abrjagad / holo snippet.rb
Last active August 29, 2015 14:16
Sublime snippets
<snippet>
<content><![CDATA[
/*doc
---
title: ${1:Title}
name: ${2:name}
category: ${3:Category}
---
${4:Description.}
@abrjagad
abrjagad / ruby
Last active August 29, 2015 14:16
Ruby & gem setup
http://rubyinstaller.org/downloads/
// ruby and devkit - download from here
ruby -v // check version
//devkit instalation
//extract the zip archive anywhere
// in cmd - go that location
// and run these two commands
@abrjagad
abrjagad / Grunt configuration
Last active August 29, 2015 14:16
Grunt configuration
node -v // check node
npm update -g npm //update npm
npm install -g grunt-cli //install grunt command line
//existing project
npm install
grunt
//new project
@abrjagad
abrjagad / auto resize iframe.js
Last active August 29, 2015 14:16
adjust the width and height of iframe
function autoResize(id) {
var newheight;
var newwidth;
var id = document.getElementById(id);
newheight = id.contentWindow.document.body.scrollHeight;
newwidth = id.contentWindow.document.body.scrollWidth;
id.height = newheight + "px";
<style>
.line-behind {
position: relative;
text-align: center;
&:after {
content: "";
height: 3px;
display: block;
position: absolute;
left: 0;
var player, playButton = document.getElementById("play-button"),youttubeplayer = [];
/* this function gets called when API is ready to use*/
function onYouTubePlayerAPIReady() {
/* create the global player from the specific iframe (#video)*/
if (typeof(youtubeVideo) !== "undefined") {
player = new YT.Player('video', {
videoId: youtubeVideo,
playerVars: {
wmode: "opaque"
},
@abrjagad
abrjagad / Inside Function declaration.js
Last active August 29, 2015 14:15
how "this" keyword behaves
function c(){
return this;
}
c() //prints window
var obj = {
a:1,
b:2
}
var a = 1;
function b() {
a = 10;
return;
function a() {}
}
b();
alert(a);
//Using the code above, the browser will alert "1".
function getFunc() {
var a = 7;
return function(b) {
alert(a+b);
}
}
var f = getFunc();
f(5);
//12