This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>AngularJS looping example</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js"></script> | |
</head> | |
<body> | |
<div ng-app="app" ng-controller="controller"> |
This file contains 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(){ | |
var json_args = { | |
num1: 5, | |
num2: 3 | |
}; | |
var showResult = function(res){ | |
alert(res.sum); | |
}; |
This file contains 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 controller = function($http){ | |
var json_args = { | |
num1: 5, | |
num2: 3 | |
}; | |
var showResult = function(res){ | |
alert(res.data.sum); | |
} |
This file contains 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
<!-- This component is embedded into the template html | |
of the 'mainApp' component.--> | |
<aps-search-results results="mc.searchResults"></aps-search-results> |
This file contains 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 apsSearchResults = function(){ | |
var d = {}; | |
d.restrict = "E"; | |
d.scope = { | |
results: "=" | |
}; | |
d.templateUrl = "searchresults/searchresults.html"; | |
d.controller = "searchResultsController"; | |
d.controllerAs = "src"; |
This file contains 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
from subprocess import check_output | |
command_str = "/usr/bin/apt-cache stats" | |
raw_results = check_output(command_str, shell=True) |
This file contains 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
tupled_result_list = [tuple(result.split(" - ")[:2]) | |
for result in result_list | |
if result] |
This file contains 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
import re | |
def image_format(file_name): | |
raw_data = open(file_name, "rb").read() | |
ascii_data = raw_data.decode("ascii", errors="ignore") | |
for result in re.finditer(r"\w+", ascii_data): | |
word = result.group() | |
return word |
This file contains 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 googleDirective = function(){ | |
var d = {}; | |
d.restrict = "E"; | |
d.link = function(scope, elem, attrs){ | |
var textBody = elem.html(); | |
var url = "http://www.google.com/search?q=" + escape(textBody) | |
var searchTag = "<a href='" + url + "'>" + textBody + "</a>"; | |
elem.html(searchTag) | |
}; | |
return d; |
This file contains 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 googleDirective = function(){ | |
var d = {}; | |
d.restrict = "E"; | |
d.link = function(scope, elem, attrs){ | |
}; | |
return d; | |
}; |