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
jQuery.validator.setDefaults({ | |
validClass: "success", | |
errorElement: "span", | |
errorPlacement: function(error, element){ | |
$(error).addClass('help-block').insertAfter(element); | |
}, | |
highlight: function(element, errorClass, validClass) { | |
$(element).parents('div.control-group').addClass(errorClass).removeClass(validClass); | |
}, | |
unhighlight: function(element, errorClass, validClass) { |
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
//Put this code in the main controller | |
$scope.$on('$viewContentLoaded', function(event) { | |
$window._gaq.push(['_trackPageview', $location.path()]); | |
}); |
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
public class DbConfig | |
{ | |
public readonly string ConnectionString = ConfigurationManager.ConnectionStrings["TestDb"].ConnectionString; | |
public readonly OrmLiteConnectionFactory DbFactory; | |
public DbConfig() | |
{ | |
DbFactory = new OrmLiteConnectionFactory(ConnectionString, PostgreSqlDialect.Provider); | |
} |
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 app = angular.module('plunker', []); | |
app.controller('MainCtrl', function($scope, $timeout) { | |
$scope.save = function(){ | |
$scope.loading = true; | |
$timeout(function(){ | |
$scope.loading = false; | |
}, 3000); | |
}; |
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 generateGuid = function(){ | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
var r = Math.random()*16|0,v=c=='x' ? r : r & 0x3 | 0x8; | |
return v.toString(16); | |
}); | |
} | |
console.log(generateGuid()); |
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
angular.module('ddsiteApp').filter('url', ['$location', function ($location) { | |
return function (subUrl, parameter) { | |
var protocol = window.location.protocol, | |
host = window.location.host, | |
pathName = window.location.pathname; | |
if(pathName === '/') { | |
} | |
console.log(protocol + '//' + host + '/#/' + subUrl + '/' + parameter); | |
return protocol + '//' + host + '/#/' + subUrl + '/' + parameter; |
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 urlfetch | |
from bs4 import BeautifulSoup | |
url = "http://www.congreso.gob.pe/organizacion/pleno.asp?mode=Pleno" | |
response = urlfetch.get(url) | |
htmlContent = response.content | |
soup = BeautifulSoup(htmlContent) | |
dumped = soup.find(id="frmPleno").findAll("table")[2].findAll("tr") | |
for item in dumped: | |
if item.find('a'): | |
print item.find('a')['href'].replace("FichaCongresista.asp?C_Persona=", "") |
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
angular.module('Your_Name_App').directive('staticMap', [function () { | |
return { | |
restrict: 'A', | |
template: '<a href="{{mapUrl}}" target="_blank"><img src="{{mapUrl}}" /></a>', | |
replace: true, | |
scope: { | |
position: '=position', | |
}, | |
link: function postLink(scope, element, attrs, controller) { | |
var generateStaticMap = function() { |
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
'use strict'; | |
angular.module('buttonsApp').directive('ladda', ['$timeout', function ($timeout) { | |
return { | |
restrict: 'A', | |
scope: { | |
stop: '=stop' | |
}, | |
link: function postLink(scope, element, attrs) { | |
var l = Ladda.create(element[0]); |
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
{ | |
"name": "Daily Meeting", | |
"organization_id" : 1, | |
"start_date" : "11/2/2013" | |
"content" : [ | |
{ | |
"question" : "Question Number 1?", | |
"answer" : "Answer number 1" | |
}, | |
{ |
OlderNewer