This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| angular.module("MyApp", []) | |
| .controller("MathCtrl", function($scope) { | |
| $scope.add = function(x, y) { | |
| return x + y; | |
| }; | |
| }) | |
| .directive("myAddThings", function() { | |
| return { | |
| restrict: "E", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <snippet> | |
| <content><![CDATA[ | |
| /*doc | |
| --- | |
| title: ${1:Title} | |
| name: ${2:name} | |
| category: ${3:Category} | |
| --- | |
| ${4:Description.} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style> | |
| .line-behind { | |
| position: relative; | |
| text-align: center; | |
| &:after { | |
| content: ""; | |
| height: 3px; | |
| display: block; | |
| position: absolute; | |
| left: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function c(){ | |
| return this; | |
| } | |
| c() //prints window | |
| var obj = { | |
| a:1, | |
| b:2 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var a = 1; | |
| function b() { | |
| a = 10; | |
| return; | |
| function a() {} | |
| } | |
| b(); | |
| alert(a); | |
| //Using the code above, the browser will alert "1". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getFunc() { | |
| var a = 7; | |
| return function(b) { | |
| alert(a+b); | |
| } | |
| } | |
| var f = getFunc(); | |
| f(5); | |
| //12 |