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
sampleApp.directive('myUsername', [ function(){ | |
// Runs during compile | |
return { | |
require: 'ngModel', | |
restrict: 'A', | |
link: function($scope, iElm, iAttrs, controller) { | |
controller.$parsers.unshift(function(value){ | |
//allow only alphanumeric characters | |
var reg = /^\w+$/ ; |
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
<html ng-app="sampleApp"> | |
<head> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js"></script> | |
<script type="text/javascript"> | |
var sampleApp = angular.module("sampleApp", []); | |
sampleApp.controller('sampleCtrl', ['$scope', | |
function($scope) { | |
$scope.skills = ["Java", "C", "C++", "PHP", "ColdFusion"]; | |
$scope.mySkill = "Java"; |
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
<html ng-app="sampleApp"> | |
<head> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js"></script> | |
<script type="text/javascript"> | |
var sampleApp = angular.module("sampleApp", []); | |
sampleApp.controller('sampleCtrl', ['$scope', | |
function($scope) { | |
$scope.skills = ["Java", "C", "C++", "PHP", "ColdFusion"]; | |
$scope.mySkill = {fav: "Java"}; |
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
<cfparam name="FORM.username" default="" type="string" > | |
<cfparam name="FORM.password" default="" type="string" > | |
<cfif structKeyExists(FORM,"submit")> | |
<cfset recaptcha = FORM["g-recaptcha-response"] > | |
<cfif len(recaptcha)> | |
<cfset googleUrl = "https://www.google.com/recaptcha/api/siteverify"> | |
<cfset secret = "6LctadUSAAAAAM7NPoPq5jlbm3a37ib3sHlRFyNE"> |
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
<cfset CustomerData = StructNew()> | |
<cfset StructInsert(CustomerData, "Personal", "" , 1)> | |
<cfset testqry = queryNew("FirstName,LastName","varchar,varchar")> | |
<cfset newRow = QueryAddRow(testqry, 2)> | |
<cfset temp = QuerySetCell(testqry, "FirstName", "Deepak",1)> | |
<cfset temp = QuerySetCell(testqry, "LastName", "Kumar",1)> | |
<!--- Get Base Customer Info ---> | |
<cfquery dbtype="query" name="CustomerData.Personal"> |
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
class StudentController < ApplicationController | |
respond_to :html, :xml, :json | |
def index | |
begin | |
@students = Student.all | |
# respond_to do |format| | |
# format.html { Rails.logger.warn { "html executed." } } | |
# format.js {render "show_person_details"} | |
# format.xml { render :xml => @students.to_xml } |
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
<%#= '<script>alert("Hii")</script>' %> | |
<!--The above will escape by default--> | |
<%#= '<script>alert("Hii")</script>'.html_safe %> | |
<!--The above will alert Hii because we are marking the string as safe.--> | |
<%#= h('<script>alert("Hii")</script>') %> | |
<!--Its same as the first one.--> | |
<%#= raw('<script>alert("Hii")</script>') %> |
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
def get_user_progress | |
if @course.present? && @resource.present? | |
course_tracking = Tracking.where(user_id: current_user.id, key: @course.key).first | |
return if course_tracking.nil? | |
if course_tracking.is_completed | |
@progress = 100 | |
@quizFinished = true | |
else | |
@progress = course_tracking.get_course_progress(@course) | |
@quizFinished = course_tracking.quizzies_completed?(@course) |