Skip to content

Instantly share code, notes, and snippets.

@jakubzitny
Last active January 19, 2024 10:06
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save jakubzitny/fa652744a52ad97ac1d4a44fa39c9b0c to your computer and use it in GitHub Desktop.
Save jakubzitny/fa652744a52ad97ac1d4a44fa39c9b0c to your computer and use it in GitHub Desktop.
StackOverflow JS <code> snipptes - filtered, unescaped
// SNIPPET:
e.preventDefault()
// SNIPPET:
onclick='document.formName.submit();'
// SNIPPET:
<script type=\"text/javascript\" src=\"../../scripts/common.js\"></script>
// SNIPPET:
var t = document.createTextNode(text)
parent.appendChild(t);
// SNIPPET:
self.puff({duration: 0, queue: 'end',
afterFinish: Element.remove.bindAsEventListener(self)
});
// SNIPPET:
Element.remove.bindAsEventListener(self)
// SNIPPET:
function() { self.remove(); }
// SNIPPET:
[Exception... \"An invalid or illegal string was specified\" code: \"12\" nsresult: \"0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)\" location: \"http://mrdoob.com/projects/chromeexperiments/depth_of_field__debug/js/net/hires/debug/Stats.js Line: 105\"]
// SNIPPET:
graph.putImageData(graphData, 1, 0, 0, 0, 69, 50);
// SNIPPET:
var Stats = {
baseFps: null,
timer: null,
timerStart: null,
timerLast: null,
fps: null,
ms: null,
container: null,
fpsText: null,
msText: null,
memText: null,
memMaxText: null,
graph: null,
graphData: null,
init: function(userfps)
{
baseFps = userfps;
timer = 0;
timerStart = new Date() - 0;
timerLast = 0;
fps = 0;
ms = 0;
container = document.createElement(\"div\");
container.style.fontFamily = 'Arial';
container.style.fontSize = '10px';
container.style.backgroundColor = '#000033';
container.style.width = '70px';
container.style.paddingTop = '2px';
fpsText = document.createElement(\"div\");
fpsText.style.color = '#ffff00';
fpsText.style.marginLeft = '3px';
fpsText.style.marginBottom = '-3px';
fpsText.innerHTML = \"FPS:\";
container.appendChild(fpsText);
msText = document.createElement(\"div\");
msText.style.color = '#00ff00';
msText.style.marginLeft = '3px';
msText.style.marginBottom = '-3px';
msText.innerHTML = \"MS:\";
container.appendChild(msText);
memText = document.createElement(\"div\");
memText.style.color = '#00ffff';
memText.style.marginLeft = '3px';
memText.style.marginBottom = '-3px';
memText.innerHTML = \"MEM:\";
container.appendChild(memText);
memMaxText = document.createElement(\"div\");
memMaxText.style.color = '#ff0070';
memMaxText.style.marginLeft = '3px';
memMaxText.style.marginBottom = '3px';
memMaxText.innerHTML = \"MAX:\";
container.appendChild(memMaxText);
var canvas = document.createElement(\"canvas\");
canvas.width = 70;
canvas.height = 50;
container.appendChild(canvas);
graph = canvas.getContext(\"2d\");
graph.fillStyle = '#000033';
graph.fillRect(0, 0, canvas.width, canvas.height );
graphData = graph.getImageData(0, 0, canvas.width, canvas.height);
setInterval(this.update, 1000/baseFps);
return container;
},
update: function()
{
timer = new Date() - timerStart;
if ((timer - 1000) > timerLast)
{
fpsText.innerHTML = \"FPS: \" + fps + \" / \" + baseFps;
timerLast = timer;
graph.putImageData(graphData, 1, 0, 0, 0, 69, 50);
graph.fillRect(0,0,1,50);
graphData = graph.getImageData(0, 0, 70, 50);
var index = ( Math.floor(Math.min(50, (fps / baseFps) * 50)) * 280 /* 70 * 4 */ );
graphData.data[index] = graphData.data[index + 1] = 256;
index = ( Math.floor(Math.min(50, 50 - (timer - ms) * .5)) * 280 /* 70 * 4 */ );
graphData.data[index + 1] = 256;
graph.putImageData (graphData, 0, 0);
fps = 0;
}
++fps;
msText.innerHTML = \"MS: \" + (timer - ms);
ms = timer;
}
// SNIPPET:
var myFunc1 = function(event) {
alert(1);
}
var myFunc2 = function(event) {
alert(2);
}
element.addEventListener('click', myFunc1);
element.addEventListener('click', myFunc2);
// SNIPPET:
event.stopPropagation()
// SNIPPET:
<div id=\"LightBoxItemList\">
<a href=\"Images/large01.jpg\" rel=\"shadowbox[Mixed];\" class=\"First\" />
<a href=\"Images/Hydro_Sample.swf\" rel=\"shadowbox[Mixed];width: 800;height: 600;\" />
<a href=\"Images/large01.jpg\" rel=\"shadowbox[Mixed];\" />
</div>
// SNIPPET:
Shadowbox.clearCache();
Shadowbox.setup(\"#LightBoxItemList a\");
// SNIPPET:
try
{
throw SomeException(\"hahahaha!\");
}
catch (Exception ex)
{
Log(ex.ToString());
}
// Output
SomeNamespace.SomeException: hahahaha!
at ConsoleApplication1.Main() in ConsoleApplication1\\Program.cs:line 27
// SNIPPET:
try
{
var WshShell = new ActiveXObject(\"WScript.Shell\");
return WshShell.RegRead(\"HKEY_LOCAL_MACHINE\\\\Some\\\\Invalid\\\\Location\");
}
catch (ex)
{
Log(\"Caught exception: \" + ex);
}
// Output
Caught exception: [object Error]
// SNIPPET:
>>> next_link.__class__.__name__
'Link'
>>> next_link
Link(base_url='http://www.citius.mj.pt/Portal/consultas/ConsultasDistribuicao.aspx', url=\"javascript:__doPostBack('ctl00$ContentPlaceHolder1$Pager1$lnkNext','')\", text='2', tag='a', attrs=[('id', 'ctl00_ContentPlaceHolder1_Pager1_lnkNext'), ('title', 'P\\xc3\\xa1gina seguinte: 2'), ('href', \"javascript:__doPostBack('ctl00$ContentPlaceHolder1$Pager1$lnkNext','')\")])
>>> req = mech.click_link(next_link)
>>> req
<urllib2.Request instance at 0x025BEE40>
>>> req.has_data()
False
// SNIPPET:
<a href=\"javascript:window.print()\">Print this page</a>
// SNIPPET:
window.close()
// SNIPPET:
new Date();
// SNIPPET:
2009-12-24 14:20:57
// SNIPPET:
[AcceptVerbs (HttpVerbs.Put)]
[Authorize]
[JsonFilter(Param=\"Designer\", JsonDataType=typeof(Designer))]
public JsonResult SaveProfile(Designer Profile)
{
ProfileRepository Repo = new ProfileRepository();
Designer d = Repo.GetById(Profile.ID);
d.Comments = Profile.Comments;
d.DisplayName = Profile.DisplayName;
d.Email = Profile.Email;
d.FirstName = Profile.FirstName;
d.LastName = Profile.LastName;
Repo.Update(d);
return Json(Profile);
}
// SNIPPET:
$('#save-profile').click(function () {
var Profile = {};
var context = $('#profile-data')[0];
$('span', context).each(function () {
Profile[this.id] = $(this).text();
});
Profile.ID = $('h3', context).attr('id');
console.log(Profile);
//var DTO = { 'Profile': Profile };
$.ajax({
type: \"PUT\",
url: \"/Home/SaveProfile\",
data: { 'Profile': Profile },
success: function (data) {
console.log(data);
}
});
});
// SNIPPET:
<!--[if lt IE 7]>
<script src=\"http://ie7-js.googlecode.com/svn/version/2.1(beta2)/IE7.js\"></script>
<![endif]-->
// SNIPPET:
<img src=\"\" />
// SNIPPET:
Column IN ('a', 'b', 'c')
// SNIPPET:
if (expression1 || expression2 || str === 'a' || str === 'b' || str === 'c') {
// do something
}
// SNIPPET:
if (expression1 || expression2 || {a:1, b:1, c:1}[str]) {
// do something
}
// SNIPPET:
var str = 'a',
flag = false;
switch (str) {
case 'a':
case 'b':
case 'c':
flag = true;
default:
}
if (expression1 || expression2 || flag) {
// do something
}
// SNIPPET:
['a', 'b', 'c'].indexOf(str) !== -1
// SNIPPET:
indexOf
// SNIPPET:
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(item) {
var i = this.length;
while (i--) {
if (this[i] === item) return i;
}
return -1;
};
}
// SNIPPET:
Array.prototype
// SNIPPET:
var arr = ['alpaca', 'bear', 'caribou'];
var index;
for (index in arr) {
console.log(item);
// 0, 1, 2, indexOf
}
// SNIPPET:
for (index in arr) {
if (arr.hasOwnProperty(index)) {
// do something;
}
}
// SNIPPET:
Array
// SNIPPET:
Object
// SNIPPET:
var length = index.length; for (index = 0; index < length; index +=1) { }
// SNIPPET:
function reloadDeliveryForm()
{
$('#deliveryForm').load('./ajax/deliveryToVenueForm.html',
function(response, status, xhr)
{
if (status == \"error\")
{
$.prompt(\"Sorry but there was an error, please try again.<br />\" +
\"If same error persists, please report to webmaster.\");
}
else //deliveryForm loaded successfully
{
validateDeliveryForm();
$(\"#delivery_special\").elastic();
$('#special_conditions_tip').click(function()
{
console.log(\"start filling\");
fillTextareaWithExample();
console.log(\"end filling\");
$.scrollTo('#delivery_special');
console.log(\"end scrolling\");
});
}
});
// SNIPPET:
n.value1s = new Array();
n.value1sIDs = new Array();
n.value1sNames = new Array();
n.value1sColors = new Array();
n.descriptions = new Array();
// SNIPPET:
pg.loadLinkedvalue1s(n);
// SNIPPET:
if(n.id == \"row\"){
n.rs = n.parentElement;
if(n.rs.multiSelect == 0){
n.selected = 1;
this.selectedRows = [ n ];
if(this.lastClicked && this.lastClicked != n){
selectionChanged = 1;
this.lastClicked.selected = 0;
this.lastClicked.style.color = \"000099\";
this.lastClicked.style.backgroundColor = \"\";
}
} else {
n.selected = n.selected ? 0 : 1;
this.getSelectedRows();
}
this.lastClicked = n;
n.value1s = new Array();
n.value1sIDs = new Array();
n.value1sNames = new Array();
n.value1sColors = new Array();
n.descriptions = new Array();
n.value2s = new Array();
n.value2IDs = new Array();
n.value2Names = new Array();
n.value2Colors = new Array();
n.value2SortOrders = new Array();
n.value2Descriptions = new Array();
var value1s = myOfficeFunction.DOMArray(n.all.value1s.all.value1);
var value2s = myOfficeFunction.DOMArray(n.all.value1s.all.value2);
for(var i=0,j=0,k=1;i<vaue1s.length;i++){
n.sortOrders[j] = k++;
n.vaue1s[j] = vaue1s[i].v;
n.vaue1IDs[j] = vaue1s[i].i;
n.vaue1Colors[j] = vaue1s[i].c;
alert(n.vaue1Colors[j]);
var vals = vaue1s[i].innerText.split(String.fromCharCode(127));
n.cptSortOrders[j] = k++;
n.value2s[j] = value2s[i].v;
n.value2IDs[j] = value2s[i].i;
n.value2Colors[j] = value2s[i].c;
var value2Vals = value2s[i].innerText.split(String.fromCharCode(127));
if(vals.length == 2){
alert(n.vaue1Colors[j]);
n.vaue1Names[j] = vals[0];
n.descriptions[j++] = vals[1];
}
if(value2Vals.length == 2){
n.value2Names[j] = cptVals[0];
alert(n.value2Names[j]);
n.cptDescriptions[j++] = cptVals[1];
alert(n.cptDescriptions[j++]);
}
}
//want to run this with value1 only
pg.loadLinkedvalue1s(n);
// want to run this with value2 only
pg.loadLinkedvalue2s(n);
}
// SNIPPET:
$(\".TypeFilter\").change(function()
{
// Extract value from TypeFilter and update page accordingly
));
// SNIPPET:
.change(function()
// SNIPPET:
<script type=\"text/javascript\">
var model=$(\"#tags1\").val();
var version[0,0]=\"JD\";
var version[0,1]=\"87.5-107.9\";
var version[1,0]=\"ED\";
var version[1,1]=\"87.5-108.0\";
var version[2,0]=\"EED\";
var version[2,1]=\"65.0-74.0\";
// each version
for (var i = 0; i < version.length; i ++) {
if (model.lastIndexOf(version[i,0])!=-1) {
$(\"#value\").replaceWith(\"<div id='value'>\"+version[i,1]+\"</div>\");
} else {
$(\"#value\").replaceWith(\"<div id='value'></div>\")
}
// end each
}
</script>
// SNIPPET:
jQuery(top.window.frames['the_iFrame'][1].document).contents()[0]
// SNIPPET:
myImgUrl = '../images';
// SNIPPET:
<img src=\"http://../images/somefile.jpg\" />
// SNIPPET:
function core() {
console.log( \"CORE CONSTRUCTOR CALLED\" );
}
core.prototype.output = function() {
return 'CORE';
}
function sub1() {
console.log( \"SUB 1 CONSTRUCTOR CALLED\" );
this.core();
}
sub1.prototype = core.prototype;
sub1.prototype.constructor = sub1;
sub1.prototype.core = core;
sub1.prototype.output = function() {
return 'SUB 1';
}
function sub2() {
console.log( \"SUB 2 CONSTRUCTOR CALLED\" );
this.core();
}
sub2.prototype = core.prototype;
sub2.prototype.constructor = sub2;
sub2.prototype.core = core;
sub2.prototype.output = function() {
return 'SUB 2';
}
var oCore = new core();
var oSub1 = new sub1();
var oSub2 = new sub2();
console.log( oCore.output() );
console.log( oSub1.output() );
console.log( oSub2.output() );
// SNIPPET:
CORE CONSTRUCTOR CALLED
SUB 1 CONSTRUCTOR CALLED
CORE CONSTRUCTOR CALLED
SUB 2 CONSTRUCTOR CALLED
CORE CONSTRUCTOR CALLED
SUB 2
SUB 2
SUB 2
// SNIPPET:
<input type=\"text\" class=\"datepicker\" id=\"dp1\">
<a href=\"javascript:;\" class=\"tab\" name=\"1,2\">test button</a>
// SNIPPET:
$(document).ready(function(){
var pickable = { dp1: [4,5,6] };
$(\".tab\").click(function () {
var test = $(this).attr(\"name\").split(\",\");
pickable = { dp1: test };
});
$(\".datepicker\").each(function() {
$(this).datepicker({
beforeShowDay: function(date){
var day = date.getDay(), days = pickable[this.id];
return [$.inArray(day, days) > -1, \"\"];
},
});
});
});​
// SNIPPET:
</script>
// SNIPPET:
(function test() {
alert('test');
})();
// SNIPPET:
<head runat=\"server\">
<link href=\"/Content/Site.css\" rel=\"stylesheet\" type=\"text/css\" />
<asp:ContentPlaceHolder runat=\"server\" ID=\"HeadContent\" />
</head>
<body>
<div id=\"content\">
<div id=\"main\">
<asp:ContentPlaceHolder ID=\"MainContent\" runat=\"server\" />
</div>
</div>
</body>
// SNIPPET:
<asp:Content ID=\"Content1\" ContentPlaceHolderID=\"MainContent\" runat=\"server\">
<% using (Html.BeginForm(\"Create\", \"Document\", FormMethod.Post))
{ %>
<p>
<%: Html.LabelFor(m => m.Title) %>
<%: Html.TextBoxFor(m => m.Title) %>
<%: Html.ValidationMessageFor(m => m.Title) %>
</p>
<p>
<input type=\"submit\" class=\"t-button t-state-default\" value=\"Create\" />
</p>
<% } %>
</asp:Content>
<asp:Content ID=\"Content2\" ContentPlaceHolderID=\"HeadContent\" runat=\"server\">
</asp:Content>
// SNIPPET:
<div id=\"test\" oncontextmenu=\"someFunction()\">
<input id=\"textbox\" type=\"text\" disabled=\"disabled\">
SOME_PADDING
<input id=\"calendar\" type=\"image\" disabled=\"disabled\">
</div>
// SNIPPET:
roof_width = 5;
roof_depth = 3;
panel_width = 2;
panel_depth = 1;
panel_power = 200;
roof_margin = 0.100;
panel_gap = 0.05;
roof_width = document.getElementById('roof_width').value;
roof_depth = document.getElementById('roof_depth').value;
// panel_width = document.getElementById('panel_width').value;
// panel_depth = document.getElementById('panel_depth').value;
panel_power = document.getElementById('panel_power').value;
// roof_margin = document.getElementById('roof_margin').value;
panel_gap = document.getElementById('panel_gap').value;
// SNIPPET:
<p><span id=\"more-76\"></span></p>
// SNIPPET:
<div class=\"work1alt\">
<p><span id=\"more-76\"></span></p>
</div>
// SNIPPET:
var people = new Lawnchair('people');
// SNIPPET:
<html>
<head>
<script type=\"text/javascript\" src=\"/javascripts/tiny_mce/tiny_mce.js\"></script>
<script type=\"text/javascript\">
tinyMCE.init({
theme : \"advanced\",
mode : \"textareas\",
});
</script>
<script type=\"text/javascript\">
testclonenode = {
addAbove : function (element) {
var rowEl = element.parentNode.parentNode.parentNode;
var rowElClone = rowEl.cloneNode(true);
rowEl.parentNode.insertBefore(rowElClone, rowEl);
return false;
}
};
</script>
</head>
<body>
<table>
<tr><td>
<textarea name=\"content\" style=\"width:100%\">this is a test </textarea>
<p> <button onclick='return testclonenode.addAbove.call(testclonenode, this);'> Add above </button>
</td></tr>
</table>
</body></html>
// SNIPPET:
<div id = \"cs_DynamicForm\">
\"Phone number...\"
<div>
// SNIPPET:
<a onclick=\"javascript: pageTracker._trackPageview('/Contact/UK/phone');\" id=\"phoneNumberToggle\" class=\"more-info-link\" href=\" javascript:void(0);\">Phone us</a>
// SNIPPET:
_dynamicPhoneNumber: function(type, arg)
{
var phoneNumber = document.getElementById(\"cs_DynamicForm\");
var vis =phoneNumber.style;
//alert(vis);
if(vis.display==''&&phoneNumber.offsetWidth!=undefined&&phoneNumber.offsetHeight!=undefined)
vis.display = (phoneNumber.offsetWidth!=0&&phoneNumber.offsetHeight!=0)?'block':'none';
vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
// SNIPPET:
try{
var phoneNumber = document.getElementById(\"cs_DynamicForm\");
var vis =phoneNumber.style;
//alert(vis);
if(vis.display==''&&phoneNumber.offsetWidth!=undefined&&phoneNumber.offsetHeight!=undefined)
vis.display = (phoneNumber.offsetWidth!=0&&phoneNumber.offsetHeight!=0)?'block':'none';
vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
catch (e)
{
var errorMsg=e.message;
if (typeof (e.number) != \"undefined\") {
document.write (\"<br />\");
document.write (\"The error code: <b>\" + e.number + \"</b>\");
}
if (typeof (e.lineNumber) != \"undefined\") {
document.write (\"<br />\");
document.write (\"The error occurred at line: <b>\" + e.lineNumber + \"</b>\");
}
//And send the errorMsg to google analytics. how I should do that
}
// SNIPPET:
//Function to print Web Part
function PrintIframe()
{
if (window.frames[frameName].innerHTML != \"\") {
window.frames[frameName].focus();
window.frames[frameName].print();
} else {
setTimeout(PrintIframe,1000);
}
}
// SNIPPET:
Func<dynamic, HelperResult> sampleTemplate =
@<span>Sample markup @item.Something</span>;
// SNIPPET:
for(int idxSample = 0; idxSample < Model.Number; idxSample++) {
@sampleTemplate(new { Something = \"\" })
}
// SNIPPET:
<script type=\"text/javascript\">
var someJsTemplate = \"\" +
<r><[!CDATA[@sampleTemplate(new { Something = \"\" })]]></r>;
</script>
// SNIPPET:
someJsTemplate
// SNIPPET:
<span>
http://j.mp/eUcRNK
</span>
// SNIPPET:
<span>
<a href=\"http://j.mp/eUcRNK\" class=\"link\" target=\"_blank\">
http://j.mp/eUcRNK
</a>
</span>
// SNIPPET:
App\\SomeComponent.js
App\\widget\\SomeWidget.js
App\\thing\\SomeThing.js
// SNIPPET:
ISomeWidget.js
// SNIPPET:
widget
// SNIPPET:
IWidget.js
// SNIPPET:
widget
// SNIPPET:
function Vector()
{
var vector = [];
vector.sum = function()
{
sum = 0.0;
for(i = 0; i < this.length; i++)
{
sum += this[i];
}
return sum;
}
return vector;
}
v = Vector();
v.push(1); v.push(2);
console.log(v.sum());
// SNIPPET:
var query = FB.Data.query('SELECT '+response.id+', '+response.name+' FROM friendlist from user where uid=' + response.id);
// SNIPPET:
window.fbAsyncInit = function() {
FB.init({appId: '12...0', status: true, cookie: true, xfbml: true});
/* All the events registered */
FB.Event.subscribe('auth.login', function(response) {
// do something with response
login();
});
FB.Event.subscribe('auth.logout', function(response) {
// do something with response
logout();
});
FB.getLoginStatus(function(response) {
if (response.session) {
// logged in and connected user, someone you know
login();
}
});
// SNIPPET:
top.innerHeight
// SNIPPET:
Some.thing = [ {
\"swatch_src\" : \"/images/91388044000.jpg\",
\"color\" : \"black multi\",
\"inventory\" : {
\"F\" : [ 797113, 797114 ],
\"X\" : [ 797111, 797112 ]
},
\"images\" : [ {
\"postfix\" : \"jpg?53_1291146215000\",
\"prefix\" : \"/images/share/uploads/0000/0000/5244/52445892\"
}, {
\"postfix\" : \"jpg?53_1291146217000\",
\"prefix\" : \"/images/share/uploads/0000/0000/5244/52445904\"
}, {
\"postfix\" : \"jpg?53_1291146218000\",
\"prefix\" : \"/images/share/uploads/0000/0000/5244/52445909\"
} ],
\"skus\" : [ {
\"sale_price\" : 199,
\"sku_id\" : 797111,
\"msrp_price\" : 428,
\"size\" : \"s\"
}, {
\"sale_price\" : 199,
\"sku_id\" : 797112,
\"msrp_price\" : 428,
\"size\" : \"m\"
}, {
\"sale_price\" : 199,
\"sku_id\" : 797113,
\"msrp_price\" : 428,
\"size\" : \"l\"
}, {
\"sale_price\" : 199,
\"sku_id\" : 797114,
\"msrp_price\" : 428,
\"size\" : \"xl\"
} ],
\"look_id\" : 37731360
} ];;
// SNIPPET:
username1, username2 and username3 like this post.
// SNIPPET:
username1,
// SNIPPET:
.split(', ')
// SNIPPET:
username1
// SNIPPET:
var like_list = jQuery.trim(jQuery('#post_like_list-'+parts[1]).html());
updated_list = jQuery('#post_like_list-'+parts[1]).html().replace('doddsey65, ', '');
jQuery('#post_like_list-'+parts[1]).html(updated_list);
// SNIPPET:
.text()
// SNIPPET:
.html()
// SNIPPET:
var cancelPressed = false;
function redirect() {
//window.location = \"http://www.google.com\";
alert('hi!');
}
window.onbeforeunload = function() {
window.pressedTimer = setInterval(\"cancelPressed = true; clearInterval(window.pressedTimer);\",3000);
window.onbeforeunload = function() {
if (!cancelPressed) {
window.unloadTimer = setTimeout('redirect()',500);
window.onbeforeunload = function() {clearTimeout(window.unloadTimer);};
return \"Redirecting..\";
} else {
return 'wups';
}
};
return 'first!';
};
// SNIPPET:
<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\" class=\"display\" id=\"TableId\">
<thead>
<tr>
<th>Name</th>
<th>Entry</th>
<th>Exit</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
// SNIPPET:
$('#TableId').dataTable({
\"bProcessing\": true,
\"bInfo\": false,
\"sAjaxSource\": '/JSON/Path',
\"bAutoWidth\": false,
\"bRetrieve\":true
});
// SNIPPET:
{\"aaData\":[ [\"Name 1\",\"9516\",\"4851\"],
[\"Name 2\",\"251304\",\"127283\"]
]}
// SNIPPET:
replace
// SNIPPET:
{\"console\":{\"free\":false}}
// SNIPPET:
var location = '/users/45/messages/current/20/';
// SNIPPET:
'/45/messages/current/20/'
// SNIPPET:
/whatever/
// SNIPPET:
function printTable() {
var printContent = document.getElementById(\"grid2\");
var windowUrl = 'about:blank';
var num;
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime(); var printWindow = window.open(num, windowName, 'left=50000,top=50000,width=0,height=0');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
<p><input type=\"button\" value=\"Yazdır\" onClick=\"printTable();\"></p>
// SNIPPET:
<p id=\"save_<%= frugle.id %>\">
<%= link_to \"Save\", new_saveds_path(current_user.id, :post_id => post.id), :remote => true %>
</p>
// SNIPPET:
class SavedsController < ApplicationController
def new
@follow = Saved.create(:user_id => current_user.id, :post_id => params[:post_id])
@post = Post.find params[:post_id]
render :update do |page|
page.replace_html \"save_#{@post.id}\", \"#{link_to \"Unsave\", saveds_path(current_user.id, :post_id => @post.id), :method => :delete, :remote => true }\"
end
end
// SNIPPET:
<ul id=\"body\">
<li class=\"item\">1</li>
<li class=\"item\">2</li>
<li class=\"item\">3</li>
<li class=\"item\">4</li>
</ul>
// SNIPPET:
Response.Write(\"<script language=javascript>alert('ERROR');</script>);
// SNIPPET:
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), \" \", \"alert('ERROR')\",true);
// SNIPPET:
PostBack
// SNIPPET:
PostBack
// SNIPPET:
try
{
string strConnectionString = ConfigurationManager.ConnectionStrings[\"SqlServerCstr\"].ConnectionString;
SqlConnection myConnection = new SqlConnection(strConnectionString);
myConnection.Open();
string hesap = Label1.Text;
string musteriadi = DropDownList1.SelectedItem.Value;
string avukat = DropDownList2.SelectedItem.Value;
SqlCommand cmd = new SqlCommand(\"INSERT INTO AVUKAT VALUES (@MUSTERI, @AVUKAT, @HESAP)\", myConnection);
cmd.Parameters.AddWithValue(\"@HESAP\", hesap);
cmd.Parameters.AddWithValue(\"@MUSTERI\", musteriadi);
cmd.Parameters.AddWithValue(\"@AVUKAT\", avukat);
cmd.Connection = myConnection;
SqlDataReader dr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
Response.Redirect(Request.Url.ToString());
myConnection.Close();
}
catch (Exception)
{
Response.Write(\"<h2>ERROR</h2>\");
}
// SNIPPET:
function doSaveAs() {
if (document.execCommand) {
document.execCommand(\"SaveAs\");
}
}
// SNIPPET:
$('.addlist').editable('editsave.php', {
indicator : 'Adding...',
tooltip : 'Click to add...',
onblur : 'submit'
});
// SNIPPET:
$('.addlist').click(window.location.reload());
// SNIPPET:
divID = \"question-\" + i+1;
// SNIPPET:
document.getElementById(\"test\").innerHTML += \"<br />\"
// SNIPPET:
document.getElementById(\"test\").innerHTML += \"<table>\" + blahblah + \"</table>\"
// SNIPPET:
$(\"#season\").autocomplete({
source: function( request, response ) {
$.getJSON( \"search.asp\", {
term: request.term,
type: 'season'
}, response );},
minLength: 0
}).focus(function(event, ui){
$(this).autocomplete(\"search\",\"\");
});
// SNIPPET:
/tracks/add/5449326
// SNIPPET:
%2Ftracks%2Fadd%2F5449326
// SNIPPET:
/overlay/add-track/{param1}/{param2}
// SNIPPET:
/overlay/add-track/1//tracks/add/5449326
// SNIPPET:
$url = rawurlencode('/tracks/add/5449326');
echo '<a href=\"/overlay/add-track/1/'.$url.'\">Add</a>';
// SNIPPET:
$.ajax({
url: href,
type: 'POST',
data: {},
dataType: \"json\",
success: function(data)
{
// do stuff
}
});
// SNIPPET:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} \\.(eps|js|ico|gif|jpg|png|css|jpeg|doc|xls|doc|pdf|txt|ppt|zip)$
RewriteRule ^(.*)$ $1 [L]
RewriteCond \"/path/public/%{REQUEST_URI}\" !-f
RewriteRule ^(.*)$ /index.php/$1 [L]
// SNIPPET:
// Initiate asynchronous load of xml data:
jQuery.ajax({
type: \"GET\",
url: \"/wp-content/themes/mytheme/data.xml\",
dataType: \"xml\",
success: parseDataXML
});
// SNIPPET:
http://www.mydomain.com/wp-content/themes/mytheme/data.xml
// SNIPPET:
http://www.mydomain.com/site-a/wp-content/themes/mytheme/data.xml
// SNIPPET:
<a href=\"www.xxx.com\">
// SNIPPET:
$(window).keypress(function (e)
{
if (e.keyCode == 37)
{
// position 1
}
});
// SNIPPET:
while
// SNIPPET:
var o = 1;
while(o<4){
setTimeout(\"setupAnimation(o)\",2000);
//setupAnimation(o); //<--this works but everything happens att the same time
o++;
}
// SNIPPET:
var o = 1;
function repeatMe(){
setupAnimation(o);
o++;
setTimout('repeatMe()',1000);
}
// SNIPPET:
require('http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js');
// SNIPPET:
<script type=\"text/javascript\">
if (typeof jQuery == 'undefined') {
document.write(unescape(\"%3Cscript src='/scripts/jquery-1.4.4.min.js' type='text/javascript'%3E%3C/script%3E\"));
}
</script>
// SNIPPET:
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
<html dir=\"ltr\">
<head>
<style type=\"text/css\">
body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
</style>
<script src=\"http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js\"
djConfig=\"parseOnLoad: true\">
</script>
<script type=\"text/javascript\">
dojo.require(\"dojox.widget.ColorPicker\");
dojo.require(\"dijit.ColorPalette\");
dojo.require(\"dijit.form.TextBox\");
dojo.require(\"dijit.form.Textarea\");
output = \"Color=&Color,SoundFile=&SoundFile\";
function updateResults()
{
var objColorPalette = dijit.byId(\"colorPalette\");
var objColor = objColorPalette.value;
//var objColor = objColorPalette.attr(\"value\");
//alert(\"objColor=\" + objColor);
if (objColor == null)
{
output = output.replace(\"&Color\",\"null\");
}
else
{
output = output.replace(\"&Color\",objColor.toHex());
}
var objResultTextArea = dijit.byId(\"results\");
objResultTextArea.set(\"value\", output);
}
function setColor(val)
{
output = output.replace(\"&Color\",val.toHex());
var objResultTextArea = dijit.byId(\"results\");
objResultTextArea.set(\"value\", output);
}
</script>
<link rel=\"stylesheet\" type=\"text/css\" href=\"http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css\"
/>
<link rel=\"stylesheet\" href=\"http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojox/widget/ColorPicker/ColorPicker.css\"
/>
</head>
<body class=\" claro \">
<h3>Begin Data Entry</h3>
<label for=\"mp3FileName\">
Auto-trimming, Proper-casing Textbox:
</label>
<input type=\"text\" name=\"mp3FileName\" value=\"/yourRelativeFileName.mp3\" dojoType=\"dijit.form.TextBox\"
trim=\"true\" id=\"firstname\" propercase=\"true\">
<h3>Color</h3>
<div dojoType=\"dijit.ColorPalette\" onChange=\"updateResults()\" palette=\"7x10\" id=\"colorPalette\">
</div>
<!--
<h3>Color Picker</h3>
<div dojoType=\"dojox.widget.ColorPicker\" id=\"colorPicker\">
</div>
-->
<h3>Results</h3>
<textarea id=\"results\" name=\"results\" dojoType=\"dijit.form.Textarea\"
style=\"width:900px;\">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy
nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</textarea>
<h3>The End</h3>
</body>
</html>
// SNIPPET:
var url = \"http://www.youtube.com/verify_age?next_url=http%3A//www.youtube.com/watch%3Fv%3D[YOUTUBEID]\";
var ytcode = url.substr(80,50);
alert(ytcode);
// SNIPPET:
\"<input type=\\\"submit\\\" value=\\\"{0}\\\" onClick=\\\"showOk()\\\";\\\" /><div class='messagepop pop' style='display: none'><form action='' method='post' id='new_message'><div><img src='../Images/x.png' alt='Exit' class='msgPopImg' onclick='closePop()' /><table bgcolor='#FFF0F0' rules='rows'>\" + builder + \"</table></div></form></div><script type='text/javascript'>function showOk() {var maskHeight = $(document).height();var maskWidth = $(window).width();$('#mask').css({ 'width': maskWidth, 'height': maskHeight }); $('.pop').show('fast', function () { });$('#mask').show();} function closePop() {$('.pop').hide(); $('#mask').hide();}\", buttonText);
// SNIPPET:
<script type='text/javascript'>function
showOk() {var maskHeight = $(document).height();var maskWidth = $(window).width();$('#mask').css({ 'width': maskWidth, 'height': maskHeight }); $('.pop').show('fast', function () { });$('#mask').show();} function closePop() {$('.pop').hide(); $('#mask').hide();}
\"
// SNIPPET:
\"<input type=\\\"submit\\\" value=\\\"{0}\\\" onClick=\\\"showOk()\\\";\\\" /><div class='messagepop pop' style='display: none'><form action='' method='post' id='new_message'><div><img src='../Images/x.png' alt='Exit' class='msgPopImg' onclick='closePop()' /><table bgcolor='#FFF0F0' rules='rows'>\" + builder + \"</table></div></form></div><script type='text/javascript'>function showOk() {var maskHeight = 1000px;var maskWidth =1000px;$('#mask').css({ 'width': maskWidth, 'height': maskHeight }); $('.pop').css('display', 'block');$('#mask').css('display', 'block');} function closePop() {$('.pop').css('display', 'none'); $('#mask').css('display', 'none');}\", buttonText);
// SNIPPET:
element.onkeyup = function (e) {
var keyCode = (window.event) ? window.event.keyCode : e.keyCode;
var table = document.getElementById(\"PeriodListFrom_Search\").children[0];
var html = {
innerHtml: \"\",
matchCount: 0,
addRow: function (id, string) {
this.innerHtml += \"<tr id='\" + id + \"'><td>\" + string + \"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td></tr>\";
this.matchCount++;
}
};
if ($(\"#PeriodListFrom\").val() == \"\") {
$(\"#PeriodListFrom_Search\").hide();
return;
}
// Navigate down
if(keyCode==40){
var selectedIndex = 0;
// Search the table for highlighted rows
for(var i = 0; i<table.rows.length; i++){
if( $(table.rows[i]).css(\"background-color\") != \"rgba(0, 0, 0, 0)\"){
// Reset the color of the last index
$(table.rows[i]).css(\"cursor\",\"\");
$(table.rows[i]).css(\"background-color\",\"\");
selectedIndex = i+1;
break;
}
}
$(table.rows[selectedIndex]).css(\"cursor\",\"default\");
$(table.rows[selectedIndex]).css(\"background-color\",\"#FFF2E3\");
}
else if(keyCode==13) {
for(var i = 0; i<table.rows.length; i++){
if( $(table.rows[i]).css(\"background-color\") != \"rgba(0, 0, 0, 0)\"){
$(\"#PeriodListFrom\").val(table.rows[i].id);
break;
}
}
document.getElementById(\"PeriodListFrom\").onblur();
} else if(keyCode == 38) {
var selectedIndex = 0;
// Search the table for highlighted rows
for(var i = 0; i<table.rows.length; i++){
if( $(table.rows[i]).css(\"background-color\") != \"rgba(0, 0, 0, 0)\"){
// Reset the color of the last index
$(table.rows[i]).css(\"cursor\",\"\");
$(table.rows[i]).css(\"background-color\",\"\");
selectedIndex = i-1;
break;
}
}
$(table.rows[selectedIndex]).css(\"cursor\",\"default\");
$(table.rows[selectedIndex]).css(\"background-color\",\"#FFF2E3\");
} else { // Actually searching
var matches = PeriodManager.Search($(\"#PeriodListFrom\").val());
for (var i = 0; i < matches.length && i < 10; i++) {
html.addRow(matches[i], matches[i]);
}
if (html.matchCount > 0) {
$(table).html(html.innerHtml);
$(\"#PeriodListFrom_Search\").show();
} else {
$(\"#PeriodListFrom_Search\").hide();
}
}
}
// SNIPPET:
if (typeof MyNameSpace == 'undefined' || !MyNameSpace) {
var MyNameSpace = {};
}
var MyNameSpace = (function(MyNameSpace) {
MyNameSpace.MyChildStaticClass = (function() {
var myobject;
myobject = {
x:function(str) {
alert(str);
}
};
return myobject;
})();
return MyNameSpace;
} (MyNameSpace || {}));
// SNIPPET:
MyNameSpace.MyChildStaticClass.x('test');
// SNIPPET:
function MyObject(){}
Array.prototype={};
MyObject.prototype={};
var a=new Array();
var b=new MyObject();
alert(a.constructor==Array);//true
alert(b.constructor==MyObject);//false
// SNIPPET:
function ShowTable1(ColCount, ArrayOfString) {
// the arrangement is
// | aaa | bbb |
// | ccc | ddd |
}
function ShowTable2(ColCount, ArrayOfString) {
// the arrangement is
// | aaa | ccc |
// | bbb | ddd |
}
// SNIPPET:
function o1(a,b)
{
document.getElementById(a).value=b;
}
function i3()
{
var a=document.forms['f3'].elements,b='f3e';
c0(a,'Please enter both a tile and a url',b)&&c4(a[2],'Please enter a valid url',b)&&d0()&&s0('pi3a.php',is('f3'),s2);
o1(f3aa,'');o1(f3bb,'');
}
function d0()
{
var a=document.getElementById('Bb1c'),
b=document.createElement('a'),
c=document.forms['f3'].elements;
b.href=c[2].value;
b.name=\"a1\";
b.className =\"b\";
b.innerHTML = c[1].value;
a.appendChild(b);
return 1;
}
// SNIPPET:
<input>
// SNIPPET:
<textarea>
// SNIPPET:
function getCaretPosGecko(txtbox) {
return txtbox.selectionStart;
}
function getCaretPosIE(txtbox) {
var range, rangeCopy;
txtbox.focus();
range = document.selection.createRange();
if (range !== null) {
rangeCopy = range.duplicate();
rangeCopy.moveToElementText(txtbox);
rangeCopy.setEndPoint('EndToStart', range);
return rangeCopy.text.length - range.text.length;
} else {
return -1;
}
}
// SNIPPET:
<textarea>
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
--
| I put the caret... | Code reports caret at position... |
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
--
| 1st line, after the \"a\" | 1 (As expected) |
| 2nd line, before the \"b\" | 2 (As expected) |
| 2nd line, after the \"b\" | 3 (As expected) |
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
--
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
--
| I put the caret... | Code reports caret at position... |
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
--
| 1st line, after the \"a\" | 1 (As expected) |
| 2nd line, before the \"b\" | 1 (Maybe it doesn't count new lines?) |
| 2nd line, after the \"b\" | 4 (Now, it seems to include \\r\\n?) |
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
--
// SNIPPET:
function getCaretPosIE(txtbox) {
var caret, normalizedValue, range, textInputRange, len, endRange;
txtbox.focus();
range = document.selection.createRange();
if (range && range.parentElement() == txtbox) {
len = txtbox.value.length;
normalizedValue = txtbox.value.replace(/\\r\\n/g, '');
textInputRange = txtbox.createTextRange();
textInputRange.moveToBookmark(range.getBookmark());
endRange = txtbox.createTextRange();
endRange.collapse(false);
if (textInputRange.compareEndPoints(\"StartToEnd\", endRange) > -1) {
caret = txtbox.value.replace(/\\r\\n/g, '\\n').length;
} else {
caret = -textInputRange.moveStart(\"character\", -len);
caret += normalizedValue.slice(0, start).split(\"\\n\").length - 1;
}
}
}
// SNIPPET:
jQuery('#contact').submit(function(event) {
if (validate_form())
{
submit_form(event);
}
else
{
return false;
}
});
var valid = true;
function validate_form()
{
valid = true;
// test form stuff here
// if something goes wrong valid will be set to false
if (!valid)
{
alert(\"form is not valid, refreshing captcha\");
// refresh form
// ....
}
else
{
alert(\"form is valid, checking captcha\");
check_recaptcha();
}
alert(\"finally, form is:\" + valid);
return valid;
}
function check_recaptcha()
{
alert(\"checking captcha now\");
// take only recaptcha values from form
var recaptcha_vals = jQuery(':input[name^=\"recaptcha\"]').serialize();
jQuery.post('recaptcha.php', recaptcha_vals, function(data) {
alert(\"recaptcha post has succeeded!\");
if (data == '1\\n' /*success!*/)
{
alert(\"recaptcha is correct!\");
jQuery('#recaptcha_error').empty();
}
else
{
alert(\"recaptcha is incorrect!\");
show_recaptcha();
jQuery('#recaptcha_error').html(\"<p class=\\\"error\\\">CAPTCHA was incorrect, please try again.</p>\");
valid = false;
}
});
}
// SNIPPET:
valid
// SNIPPET:
true
// SNIPPET:
check_recaptcha()
// SNIPPET:
valid
// SNIPPET:
false
// SNIPPET:
validate_form()
// SNIPPET:
true
// SNIPPET:
_.debounce(task, 100)
// SNIPPET:
_.debounce
// SNIPPET:
var dat = [];
$('form[name=' + form.name + '] input[name], form[name=' + form.name + '] select[name], form[name=' + form.name + '] textarea[name]').each(function(i,el) {
dat[$(this).attr('name')] = $(this).val();
});
// SNIPPET:
<asp:GridView ID=\"gv_sample\" runat=\"server\" AutoGenerateColumns=\"false\">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">
<tr>
<td>
<asp:TextBox runat=\"server\" ID=\"txtByWhen\" ReadOnly=\"true\" CssClass=\"inputbox\" Text='<%#Eval(\"ByWhen\") %>'></asp:TextBox>
</td>
<td style=\"padding-left: 2px;\">
<img src=\"../Images/dateico.gif\" alt=\"Select a date\" title=\"Select a date\"
onclick=\"JavaScript:return showCalendar('<%#((GridViewRow)Container).FindControl(\"txtByWhen\").ClientID %>','dd/mm/y');\" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
// SNIPPET:
<audio>
// SNIPPET:
var audio = {};
audio[\"walk\"] = new Audio();
audio[\"walk\"].src = \"Scr/dave.wma\"
audio[\"walk\"].load()
setTimeout('audio[\"walk\"].play()',1000);
// SNIPPET:
.style
// SNIPPET:
class Bar
foo: ->
console.log('bar')
// SNIPPET:
(function() {
class(Bar({
foo: function() {
return console.log('bar');
}
}));
}).call(this);
// SNIPPET:
<script type='text/javascript'>
var val=document.getElementById('userInput').value;
var temp=val.split(\" \");
function sum() {
for(var i=0, MISSING THIS BIT
document.getElementById('resultSum').innerHTML=MISSING THIS BIT;
}
</script>
<form name=\"input\">
<textarea name=\"userInput\" rows=20 cols=20></textarea>
<input name=\"Run\" type=Button value=\"run\" onClick=\"sum()\">
<form name=\"resultSum\"><input type=Text>
// SNIPPET:
<html>
<script type='text/javascript'>
function sum(){
var val = document.getElementById('userInput').value;
var temp = val.split(\" \");
var total = 0;
var v;
for(var i = 0; i < temp.length; i++) {
v = parseFloat(temp[i]);
if (!isNaN(v)) total += v;
}
document.getElementById('resultSum').innerHTML=total;
}
</script>
<form name=\"input\">
<textarea name=\"userInput\" rows=20 cols=20></textarea>
<input name=\"Run\" type=Button value=\"run\" onClick=\"sum()\">
<form name=\"resultSum\"><input type=text>
<html>
// SNIPPET:
function getScript(url,success){
var script=document.createElement('script');
script.src=url;
var head=document.getElementsByTagName('head')[0],
done=false;
// Attach handlers for all browsers
script.onload=script.onreadystatechange = function(){
if ( !done && (!this.readyState
|| this.readyState == 'loaded'
|| this.readyState == 'complete') ) {
done=true;
success();
script.onload = script.onreadystatechange = null;
head.removeChild(script);
}
};
head.appendChild(script);
}
function initializejQueryUI(){
if (typeof jQuery.ui == 'undefined'){
// jQueryUI library & jQueryUI cupertino theme
$('head').append(\"<link href='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/cupertino/jquery-ui.css' type='text/css' rel='stylesheet'>\");
$('head').append(\"<script id='jquilib' type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'></script>\");
}
$(\"#jquilib\").load($(\"<div>jQuery & UI Loaded!</div>\").dialog());
}
getScript('https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js', initializejQueryUI); // call initializejQueryUI as callback when jQuery loads
// SNIPPET:
//Back to top
$(window).scroll(function () {
if ( $(window).scrollTop() > 100 ) {
$('#back-to-top').fadeIn('fast');
} else {
$('#back-to-top').fadeOut('fast');
}
});
$(window).scroll();
// SNIPPET:
overlow-x
// SNIPPET:
auto
// SNIPPET:
<section id=\"slider\" class=\"horizontal\">
<!-- Some Images that are floated left -->
<div id=\"back-to-left\"></div>
</section>
.horizontal {
overflow-x: auto;
white-space: nowrap;
padding: 20px 0;
}
// SNIPPET:
#back-to-left
// SNIPPET:
$(document).ready(function() {
if ($('#my_div').hasClass('selected')) {
$(\"body\").css({backgroundColor: '#111'});
}
});
// SNIPPET:
<div id=\"one\">
<label for=\"number\">Number</label>
<div id=\"two\">
<input id=\"number\" type=\"text\" name=\"number\">
</div>
</div>
// SNIPPET:
Syntax error at line 3739 while loading:
f+Gcd(ead)+LIf+A9c.b.b+RIf+Icd(ead)+LIf+
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
--^
input too deeply nested
// SNIPPET:
<ul>
// SNIPPET:
<form id=\"update_fruit_form\" method=\"post\" action=\"/update_fruits\" accept-charset=\"UTF-8\">
<ul id=\"list_a\">
<li id=\"item_Apple\" value=\"1\">Red</li>
<li id=\"item_Green\" value=\"2\">Pear</li>
<li id=\"item_Banana\" value=\"3\">Yellow</li>
</ul>
<input type=\"submit\" value=\"Submit\">
</form>
// SNIPPET:
$(\"#update_fruit_form\").submit(function() {
$.ajax({
url: \"update_fruits.html\",
context: \"#list_a\" ,
success: function(){
$(this).addClass(\"done\");
}
});
});
// SNIPPET:
this.canvas.addEventListener('mousedown',this.input0.btnDown, false);
// SNIPPET:
function MouseController(eventHandler) {
this.handler = eventHandler;
this.contact = false;
this.coordX = 0;
this.coordY = 0;
}
MouseController.prototype.btnDown = function(event) {
// Faulty line ???
this.updateCoordinates(event);
}
MouseController.prototype.updateHIDCoordinates = function (event) {
// code to set coordX and coordY of the controller instance
// Again, I can't access the object from here as \"this\" refers to the Canvas
}
// SNIPPET:
<script type=\"text/javascript\">
$(document).ready(function() {
$(\"#customForm\").submit(function() {
var formdata = $(\"#customForm\").serializeArray();
$.ajax({
url: \"sent.php\",
type: \"post\",
dataType: \"json\",
data: formdata,
success: function(data) {
switch (data.livre) {
case 'tags':
$(\"#msgbox2\").fadeTo(200, 0.1, function() {
$(this).html('Empty tags').fadeTo(900, 1);
});
break;
default:
$(\"#msgbox2\").fadeTo(200, 0.1, function() {
$(this).html('Update').fadeTo(900, 1, function() {
$('#conteudo').load('dojo/test_Slider.php');
});
});
break;
}
}
});
return false;
});
});
</script>
// SNIPPET:
<script type=\"text/javascript\">
var slider = [];
for (i = 0; i < 5; i++) {
slider[i] = (
function(i) {
return function() {
var node = dojo.byId(\"input\"+[i]);
var n = dojo.byId(\"valores\"+[i]);
var rulesNode = document.createElement('div'+[i]);
node.appendChild(rulesNode);
var sliderRules = new dijit.form.HorizontalRule({
count:11,
style:{height:\"4px\"}
},rulesNode);
var labels = new dijit.form.HorizontalRuleLabels({
style:{height:\"1em\",fontSize:\"75%\"},
},n);
var theSlider = new dijit.form.HorizontalSlider({
value:5,
onChange: function(){
console.log(arguments);
},
name:\"input\"+[i],
onChange:function(val){ dojo.byId('value'+[i]).value = dojo.number.format(1/val,{places:4})},
style:{height:\"165px\"},
minimum:1,
maximum:9,
}
},node);
theSlider.startup();
sliderRules.startup();
}
})(i);
dojo.addOnLoad(slider[i]);
}
</script>
// SNIPPET:
Tried to register widget with id==valores0 but that id is already registered
// SNIPPET:
var matcher = new RegExp(\"%\" + dynamicnumber + \":\", \"g\");
var found = matcher.test(textinput);
// SNIPPET:
var matcher = new RegExp(\"%\" + dynamicnumber + \":\" + /([yn]{5})/, \"g\");
// SNIPPET:
target.cycle({
timeout: 0,
before: onBefore,
after: onAfter,
next: target + ', #slide-next',
prev: '#slide-prev'
})
// SNIPPET:
next
// SNIPPET:
target
// SNIPPET:
#slide-next
// SNIPPET:
next: '#slide-next',
// SNIPPET:
next: target,
// SNIPPET:
next: target + ',#slide-next',
// SNIPPET:
next
// SNIPPET:
<script id=\"product\" type=\"text/template\">
<p><span>items</span><span class='items'><%= _.each(info.items, function(books) { %>
<%= books.name + \",&nbsp\" %>
<% }); %></span></p>
</script>
// SNIPPET:
=
// SNIPPET:
<%= _.each(info.items, function(books) { %>
// SNIPPET:
<% _.each(info.items, function(books) { %>
// SNIPPET:
=
// SNIPPET:
=
// SNIPPET:
<%= books.name + \",&nbsp\" %>
// SNIPPET:
<html>
<script language=\"JavaScript\">
function createExcel()
{
document.excel.createExcel();
document.excel.setMessage(\"hello world from js\");
}
</script>
<body>
<input type=\"button\" value=\"Generate Excel\" onclick=\"createExcel()\" />
<applet id='applet' name='excel' archive='Office.jar,poi-3.7-20101029.jar' code='com.broadridge.Office.class' width='100' height='100'></applet>
</body>
</html>
// SNIPPET:
<form id=\"ddlSelections\" runat=\"server\">
<asp:ScriptManager ID=\"ScriptManager1\" runat=\"server\" EnablePartialRendering=\"true\" />
<asp:UpdatePanel ID=\"UpdatePanel2\" runat=\"server\" ChildrenAsTriggers=\"true\" UpdateMode=\"Conditional\">
<Triggers>
<asp:AsyncPostBackTrigger ControlID=\"DDL3\" EventName=\"SelectedIndexChanged\" />
</Triggers>
<ContentTemplate>
<asp:DropDownList ID=\"DDL3\" OnSelectedIndexChanged=\"testFunc\" runat=\"server\" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
<div id=\"placeholder\"></div>
// SNIPPET:
DDL3
// SNIPPET:
testFunc
// SNIPPET:
placeholder
// SNIPPET:
jQuery
// SNIPPET:
$(function () {
$(\"#DDL3\").click(function () {
alert(\"Clicked\" + $(\"#DDL3\").val());
});
});
// SNIPPET:
<select id=\"DDL3\" onchange=\"javascript:setTimeout('__doPostBack(\\'DDL3\\',\\'\\')', 0)\" name=\"DDL3\">
// SNIPPET:
<script type=\"text/javascript\">
function abc(){
var hashes = window.location.href.slice(window.location.href.indexOf('?')+1).split('&');
window.location=\"addproduct.action?\"+hashes;
return false;
}
</script>
</head>
<body>
<s:form method=\"post\" enctype=\"multipart/form-data\">
<s:textfield label=\"Name\" name=\"productBean.name\" id=\"productBean.name\"/>
<s:textfield label=\"Price\" name=\"productBean.price\" id=\"productBean.prsice\"/>
<s:textfield label=\"Description\" name=\"productBean.description\" id=\"productBean.description\"/>
<s:label name=\"upload\" value=\"Image\"></s:label>
<s:file name=\"upload\"> </s:file>
<s:submit onclick='abc()' value=\"Add Product\" ></s:submit>
</s:form>
// SNIPPET:
require.js
// SNIPPET:
window
// SNIPPET:
window.bootstrapped_models
// SNIPPET:
app.html
// SNIPPET:
<script>
var config = {
\"isAdmin\": true,
\"userId\": 1
};
var bootstrapped_models = {
\"groups\": [
{
\"id\": 1,
\"name\": \"Foo\"
},
{
\"id\": 2,
\"name\": \"Bar\"
}
]
}
</script>
// SNIPPET:
app.js
// SNIPPET:
require(['jquery', 'GroupCollection'], function($, GroupCollection) {
// extend default config
if (config) {
$.extend(defaults, config);
}
// use bootstrapped JSON here
var collection = new GroupCollection;
if (bootstrapped_models.groups.length > 0) {
collection.add(bootstrapped_models.groups);
}
});
// SNIPPET:
0,1,2,3,4
// SNIPPET:
4,1
// SNIPPET:
web = [\"cat fat hat mat\", \"that the who\"];
var search = prompt('Search?');
function count(web, pattern)
{
if (pattern)
{
var num = 0;
var result = [];
for (i = 0; i < web.length; i++)
{
var current = web[i];
var index = current.indexOf(pattern);
while (index >= 0)
{
result[result.length] = num++;
index = current.indexOf(pattern, index + 1);
}
}
return result;
}
else
{
return (\"Nothing entered!\");
}
}
alert(count(web, search));
// SNIPPET:
<a class=\"cli\" href=\"0\">Jan</a>
<a class=\"cli\" href=\"1\">Feb</a>
<a class=\"cli\" href=\"2\">Mar</a>
<a class=\"cli\" href=\"3\">Apr</a>
<a class=\"cli\" href=\"4\">May</a>
<a class=\"cli\" href=\"5\">Jun</a>
[...]
<a class=\"cli\" href=\"11\">Dec</a>
<select class=\"ui-datepicker-month\">
<option value=\"0\" style=\"display: none;\">Jan</option>
<option value=\"1\" style=\"display: none;\">Feb</option>
[...]
<option value=\"9\" style=\"display: none;\">Oct</option>
<option selected=\"selected\" value=\"10\" style=\"display: none;\">Nov</option>
<option value=\"11\" style=\"display: none;\">Dec</option>
</select>
// SNIPPET:
$(\"a.cli\").click(function(event){ //when anchor is clicked
event.preventDefault();
$(\".ui-datepicker-month\").val($(this).text());
});
});
// SNIPPET:
$(\"a.cli\").click(function(event){ //when anchor is clicked
event.preventDefault();
$(\".ui-datepicker-month\").val($(this).attr(\"href\"));
});
});
// SNIPPET:
//This function hides our fake password field and changes focus to the real one. Yet another IE workaround...
$(\"#fakepassword\").focus(function(){
$('#fakepassword').hide();
$('#password').show();
$('#password').focus();
});
//These functions perform the link hover copycat
$(\"#titleHover\").mouseenter(function(){
$(\"#titleLarge\").css('background-color', '#555');
});
$(\"#titleHover\").mouseout(function(){
$(\"#titleLarge\").css('background-color', 'transparent');
});
$(\"#titleHover\").click(function(){
$(\"#userMenu\").animate({
height: \"192px\",
}, 250, function() {
// Animation complete. Display form and swap out arrow.
$('#loginForm').css('visibility', 'visible');
$(\"#titleLarge\").css('background-color', 'transparent');
$(\"#titleHover\").unbind('mouseenter').unbind('mouseout');
//Use my sweep function to swap in values for IE
$('html').click(function() {
//Hide the login, animate menu up and swap back in down arrow.
$('#loginForm').css('visibility', 'hidden');
$(\"#userMenu\").animate({
height: \"64px\",
}, 250, function() {
$(\"#titleHover\").mouseenter(function(){
$(\"#titleLarge\").css('background-color', '#333');
});
$(\"#titleHover\").mouseout(function(){
$(\"#titleLarge\").css('background-color', 'transparent');
});
});
if ($('#password').attr('value') == '') {
$('#password').hide();
$('#fakepassword').show();
}
});
$('#userWrap').click(function(event){
event.stopPropagation();
})
});
});
// SNIPPET:
Ext.setup
({
icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: false,
onReady: function()
{
new Ext.Panel
({
fullscreen:'true',
items:[
{
xtype : 'spinnerfield',
name:'sp',
width:'20%',
height:'13%',
minValue: 0,
},
{
xtype:'textfield',
name:'price',
height:'13%',
width:'8%',
html:'<b>350</b>',
}
]
});
}
});
// SNIPPET:
//var checked = 0;
var checkIt = getCookie('cia_db');
function checkCookie() {
// if(checked == 0) {
if(checkIt == 'logged_in') {
alert('Welcome back to CIA headquarters.');
//return true;
}
//}
//checked++;
}
// SNIPPET:
<form id=\"form1\" name=\"form1\" action=\"\" method=\"get\">
<input type=\"text\" name=\"username\" id=\"username\" value=\"smeegle\" size=\"15\" onfocus=\"checkCookie();\">
// SNIPPET:
<select name=\"somename[]\" multiple=\"multiple\">
<option selected=\"selected\" value=\"val1\">Val1</option>
<option selected=\"selected\" value=\"val2\">Val2</option>
<option value=\"val3\">Val3</option>
</select>
// SNIPPET:
<select name=\"somename[]\" multiple=\"multiple\">
<option selected=\"selected\" value=\"val1\">Val1</option>
<option value=\"val2\">Val2</option> <!-- Disselected -->
<option value=\"val3\">Val3</option>
</select>
// SNIPPET:
<select name=\"somename[]\" multiple=\"multiple\">
<option value=\"val1\">Val1</option>
<!-- All other values are disselected except the one option selected -->
<option selected=\"selected\" value=\"val2\">Val2</option>
<option value=\"val3\">Val3</option>
</select>
// SNIPPET:
<div id=\"item_default_checkbox\" style=\"display: none\"
<label for=\"item_save_default\">
<input type=\"checkbox\" name=\"item_save_default\" onclick=\"itemFunction(this)\" id=\"item_save_default\"
<#if item_save_default?? && item_save_default[\"checked\"]>
checked=\"checked\"
</#if>
/>${item_save_default[\"label\"]!\"\"}
<#if item_save_default?? && item_save_default[\"tooltipText\"] != \"\">
<div id=\"item_save_default_help\" class=\"icon\">&nbsp;</div>
</#if>
</label>
</div>
// SNIPPET:
<div id=\"item_default_checkbox\">
<label for=\"item_save_default\">
<input id=\"item_save_default\" type=\"checkbox\" onclick=\"itemFunction(this)\" name=\"item_save_default\">
Save this item as default?
</label>
</div>
// SNIPPET:
<input id=\"item_save_default\" type=\"checkbox\" checked=\"checked\" onclick=\"itemFunction(this)\" name=\"item_save_default\">
// SNIPPET:
checked=\"checked\"
// SNIPPET:
context.beginPath();
// Each shape should be made up of between three and six curves
var i = random(3, 6);
var startPos = {
x : random(0, canvas.width),
y : random(0, canvas.height)
};
context.moveTo(startPos.x, startPos.y);
while (i--) {
angle = random(0, 360);
// each line shouldn't be too long
length = random(0, canvas.width / 5);
endPos = getLineEndPoint(startPos, length, angle);
bezier1Angle = random(angle - 90, angle + 90) % 360;
bezier2Angle = (180 + random(angle - 90, angle + 90)) % 360;
bezier1Length = random(0, length / 2);
bezier2Length = random(0, length / 2);
bezier1Pos = getLineEndPoint(startPos, bezier1Length, bezier1Angle);
bezier2Pos = getLineEndPoint(endPos, bezier2Length, bezier2Angle);
context.bezierCurveTo(
bezier1Pos.x, bezier1Pos.y
bezier2Pos.x, bezier2Pos.y
endPos.x, endPos.y
);
startPos = endPos;
}
// SNIPPET:
start = {
// start somewhere within the canvas element
x: random(canvas.width),
y: random(canvas.height)
};
context.moveTo(start.x, start.y);
prev = {};
prev.length = random(minLineLength, maxLineLength);
prev.angle = random(360);
prev.x = start.x + prev.length * Math.cos(prev.angle);
prev.y = start.y + prev.length * Math.sin(prev.angle);
j = 1;
keepGoing = true;
while (keepGoing) {
j++;
distanceBackToStart = Math.round(
Math.sqrt(Math.pow(prev.x - start.x, 2) + Math.pow(prev.y - start.y, 2)));
angleBackToStart = (Math.atan((prev.y - start.y) / (prev.x - start.x)) * 180 / Math.pi) % 360;
if (isNaN(angleBackToStart)) {
angleBackToStart = random(360);
}
current = {};
if (distanceBackToStart > minLineLength) {
current.length = random(minLineLength, distanceBackToStart);
current.angle = random(angleBackToStart - 90 / j, angleBackToStart + 90 / j) % 360;
current.x = prev.x + current.length * Math.cos(current.angle);
current.y = prev.y + current.length * Math.sin(current.angle);
prev = current;
} else {
// if there's only a short distance back to the start, join up the curve
current.length = distanceBackToStart;
current.angle = angleBackToStart;
current.x = start.x;
current.y = start.y;
keepGoing = false;
}
context.lineTo(current.x, current.y);
}
console.log('Shape complexity: ' + j);
context.closePath();
context.fillStyle = 'black';
context.shadowColor = 'black';
context.shadowOffsetX = -xOffset;
context.shadowOffsetY = -yOffset;
context.shadowBlur = 50;
context.fill();
// SNIPPET:
<head>
<script src=\"jquery.mobile-1.0/demos/jquery.js\" type=\"text/javascript\"></script>
<script src=\"jquery.mobile-1.0/demos/jquery.mobile-1.0.min.js\" type=\"text/javascript\"></script>
<script src=\"CodeGeneral.js\" type=\"text/javascript\"></script>
<script src=\"CodeAppDetailScreen.js\" type=\"text/javascript\"></script>
<!--Script that doesnt work properly-->
<script src=\"shadowbox/shadowbox.js\" type=\"text/javascript\"></script>
<link rel=\"stylesheet\" href=\"shadowbox/shadowbox.css\" type=\"text/css\">
<script type=\"text/javascript\">
Shadowbox.init();
</script>
<--till here-->
<link rel=\"stylesheet\" href=\"jquery.mobile-1.0/demos/jquery.mobile-1.0.min.css\">
<link rel=\"stylesheet\" href=\"StyleMaincss.css\">
</head>
// SNIPPET:
hebrew
// SNIPPET:
english
// SNIPPET:
\" ' -
// SNIPPET:
var allowed = /^(?:[\\u0590-\\u05FF\\uFB1D-\\uFB40]+|[\\w]+|[\"'])$/i;
if(!allowed.exec(name)) {
alert('not allowed');
}
// SNIPPET:
UIWebView
// SNIPPET:
function pageWidth() {
return window.innerWidth != null? window.innerWidth: document.body != null? document.body.clientWidth:null;
}
//Show/hide the correct div when the page loads
if (pageWidth() >= 480) {
$(\".siteSearchDropdown\").css(\"display\", \"none\");
$(\".siteSearchSelect\").css(\"display\", \"block\");
}
if (pageWidth() < 480) {
$(\".siteSearchDropdown\").css(\"display\", \"block\");
$(\".siteSearchSelect\").css(\"display\", \"none\");
}
// Show/hide the correct dropdown when the browser window is resized
$(window).resize(function() {
if (pageWidth() >= 480) {
$(\".siteSearchDropdown\").css(\"display\", \"none\");
$(\".siteSearchSelect\").css(\"display\", \"block\");
}
if (pageWidth() < 480) {
$(\".siteSearchDropdown\").css(\"display\", \"block\");
$(\".siteSearchSelect\").css(\"display\", \"none\");
}
});
// SNIPPET:
function myFunc(form) {
form.elements[\"submit-button\"].value = \"New<br>Text\";
\"other stuff that actually works.\"
return false;
}
// SNIPPET:
<form onSubmit=\"return myFunc(this);\">
<button name=\"submit-button\">Original<br>Text</button>
</form>
// SNIPPET:
<script>
function setCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = \"; expires=\"+date.toGMTString();
}
else {
var expires = \"\";
}
document.cookie = name+\"=\"+value+expires+\"; path=/\";
alert (value);
}
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(\";\");
for (i=0;i<ARRcookies.length;i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf(\"=\"));
y=ARRcookies[i].substr(ARRcookies[i].indexOf(\"=\")+1);
x=x.replace(/^\\s+|\\s+$/g,\"\");
if (x==c_name)
{
return unescape(y);
}
}
}
function del_cookie(name) {
document.cookie = name +
'=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
}
$j(document).ready(function(){
// remove all click-events from header_nav_submenu
$j(\".header_nav_submenu\").unbind('click');
$j(\".header_nav_submenu\").click(function(){
var goHref = $j(this).attr('href');
del_cookie(\"last_page_nav\");
alert(getCookie(\"last_page_nav\"));
setCookie(\"last_page_nav\", goHref.substring(7), 7);
alert(getCookie(\"last_page_nav\"));
});
});
</script>
// SNIPPET:
if(FriendlyURLUtil.getFriendlyURL(request.getServerName())==null){
Cookie[] cookies = ((HttpServletRequest) request).getCookies();
for(int i = 0; i < cookies.length; i++) {
if (cookies[i].getName().equals(\"last_page_nav\")) {
System.out.println(\"The days \" + cookies[i].getMaxAge());
System.out.println(\"The cookie says \" + cookies[i].getValue());
((HttpServletResponse) response).sendRedirect(cookies[i].getValue());
}
}
}
// SNIPPET:
database is running
table will be cleared
store method called for '10'.
about to insert '10'.
transaction successful for '10'
store method called for '9'.
about to insert '9'.
transaction successful for '9'
store method called for '8'.
about to insert '8'.
transaction successful for '8'
[...]
// SNIPPET:
database is running
table will be cleared
store method called for '10'.
about to insert '10'.
transaction successful for '10'
store method called for '9'.
about to insert '9'.
transaction successful for '9'
store method called for '8'.
transaction successful for '8' <-- WHERE IS MY \"about to insert '8'.\" ???
store method called for '7'.
about to insert '7'.
transaction successful for '7'
[...]
// SNIPPET:
jQuery(document).ready(function() {
jQuery(\"#gallery-68\").slides({
pagination: true,
preload: true,
preloadImage: \"http://themes.pixlito.com/Simplio/wp-content/themes/Simplio/images/ajax-loader.gif\",
generatePagination: true,
crossfade: true,
effect: \"fade\",
bigTarget: true,
hoverPause: true,
autoHeight: true,
play: 10000
});
});
// SNIPPET:
var html ='<video>'+sources+'</video>';
$.colorbox({html:html});
// SNIPPET:
<select name=\"daySelector\" id=\"daySelectorId\" onchange=\"changeDate(daySelector.value)\">
<option value=\"-1\">Day</option>
<option value=\"2012-01-30\">2012-01-30</option>
<option value=\"2012-01-31\">2012-01-31</option>
<option value=\"2012-02-01\">2012-02-01</option>
<option value=\"2012-02-02\">2012-02-02</option>
<option value=\"2012-02-03\">2012-02-03</option>
<option value=\"2012-02-04\">2012-02-04</option>
<option value=\"2012-02-05\">2012-02-05</option>
<option value=\"2012-02-06\">2012-02-06</option>
<option value=\"2012-02-07\">2012-02-07</option>
<option value=\"2012-02-08\">2012-02-08</option>
<option value=\"2012-02-09\">2012-02-09</option>
<option value=\"2012-02-10\">2012-02-10</option>
<option value=\"2012-02-11\">2012-02-11</option>
<option value=\"2012-02-12\">2012-02-12</option>
<option value=\"2012-02-13\">2012-02-13</option>
</select>
// SNIPPET:
public override void onJsErrorReceived(String errorDescription)
{
if(errorDescription.contains(\"doSomething\"))
handleError();
}
// SNIPPET:
iframe = document.createElement(\"iframe\");
iframe.id = \"XXX\";
iframe.src = \"XXX\";
iframe.setAttribute(\"scrolling\", \"no\");
iframe.style.position = \"absolute\";
iframe.style.overflow = \"hidden\";
iframe.style.zIndex = \"8000\";
iframe.style.backgroundColor = \"white\";
iframe.style.borderWidth=\"2px\";
iframe.style.borderColor=\"#045FB4\";
iframe.style.borderStyle=\"solid\";
iframe.style.allowTransparency=false;
iframe.style.opacity=1;
iframe.style.filter = \"progid:DXImageTransform.Microsoft.Alpha(opacity=100)\";
iframe.frameBorder=\"0\";
// SNIPPET:
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>parseint</title>
<script type=\"text/javascript\">
var par= \"1a\";
alert (parseInt(par,16))
</script>
</head>
<body>
</body>
</html>
// SNIPPET:
.each()
// SNIPPET:
:input
// SNIPPET:
:input
// SNIPPET:
textarea
// SNIPPET:
$(this).parent()
// SNIPPET:
$('form input[type=submit]').click(function(){
// First we get the form class
var form = $(this).parent(); // How can I make sure that the form is selected, not some other parent like div?
var formClass = $(form).attr('class');
// Then remove every previous messages on this form
$('.' + formClass + ' .validation-error').each(function(){
$(this).remove();
});
// Iterate through every input to find data that needs to be validated
$('.' + formClass + ' :input').each(function(){ // How can I make this work with textareas as well as inputs without copying this whole each loop?
// If it is marked as required proceed
if ($(this).attr('required') == 'required'){
// Getting current text and placeholder text
var currentText = $(this).val();
var placeholderText = $(this).attr('placeholder');
// Replacing spaces to avoid empty requests
currentText = currentText.replace(' ', '');
placeholderText = placeholderText.replace(' ', '');
// If current text is empty or same as placeholder proceed
if (currentText == '' || currentText == placeholderText){
// Get input position in order to place error message
var inputPos = $(this).position();
var left = inputPos.left + 200;
var top = inputPos.top - 4;
// Generate error message container and error message itself
var errorMsg = '<div class=\"validation-error\" style=\"position:absolute;left:' + left + 'px;top:' + top + 'px;\"><- This</div>';
// Appending error message to parent - form
$(this).parent().append(errorMsg);
}
}
});
});
// SNIPPET:
if (isNewCustomer) {
doSomething();
cleanup();
}
else {
$.getJSON(..., function(result) {
doSomethingElse();
cleanup();
});
}
// SNIPPET:
var do_it = doSomething;
if (!isNewCustomer) {
do_it = $.getJSON(..., function(result) {
doSomethingElse();
});
}
$.when(do_it).done(function() {
cleanup();
});
// SNIPPET:
do
// SNIPPET:
do_it
// SNIPPET:
do_it
// SNIPPET:
doSomething
// SNIPPET:
doSomething
// SNIPPET:
{
0: [0,50],
1: [25,50],
2: [148,60]
}
// SNIPPET:
function findInsertionPoint(sortedArr, val, comparator) {
var low = 0, high = sortedArr.length;
var mid = -1, c = 0;
while(low < high) {
mid = parseInt((low + high)/2);
c = comparator(sortedArr[mid], val);
if(c < 0) {
low = mid + 1;
}else if(c > 0) {
high = mid;
}else {
return mid;
}
//alert(\"mid=\" + mid + \", c=\" + c + \", low=\" + low + \", high=\" + high);
}
return low;
}
/**
* A simple number comparator
*/
function numComparator(val1, val2) {
if(val1 > val2) {
return 1;
}else if(val1 < val2) {
return -1;
}
return 0;
}
// SNIPPET:
var xmlhttp=false;
try
{
xmlhttp = new ActiveXObject(\"Msxml2.XMLHTTP\");
}
catch (e)
{
try
{
xmlhttp = new ActiveXObject(\"Microsoft.XMLHTTP\");
} catch (E)
{
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}
function doRequest()
{
xmlhttp.open('GET','http://www.google.com',true);
xmlhttp.send();
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4)
{
alert(xmlhttp.responseText);
}
};
}
// SNIPPET:
C:\\inetpub\\wwwroot\\usersData.txt
// SNIPPET:
usersData.txt
// SNIPPET:
change_password()
// SNIPPET:
/controller/method/p1/p2/p3
// SNIPPET:
/controller/method/p1
// SNIPPET:
/controller/method?p1=foo&p2=bar
// SNIPPET:
<div class=\"grid_7\">
<div class=\"big\">
The elusive
</div>
</div>
// SNIPPET:
$(function(){
$(' .grid_7 > .big').bigtext();});
// SNIPPET:
$(function(){
$(' .grid_7:first-child').bigtext();});
// SNIPPET:
public class ComponentDiagramPolygonChild
{
IconServicesSoapClient IconServicesProxy = new IconServicesSoapClient(\"IconServicesSoap\");
public string Name { get; set; }
public byte[] Icon { get; set; }
public ComponentDiagramPolygonChild(PlanViewComponent planViewComponent)
{
Name = planViewComponent.Name;
//TODO: Can icon ever return null here?
Icon = IconServicesProxy.GetIconByID(planViewComponent.Icon).Image;
planViewComponent.
}
}
// SNIPPET:
​<span class=\"test\" onclick=\"removespan(this);\">Data in red</span>
​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
​removespan = function(e)​{
alert(e.innerText);
}​
CSS : ​span.test{color:red;}
// SNIPPET:
function on_lightbox_open() {
system.contextBrowserInit();
updateUrl(year + '/' + month + '/' + id);
ads.reload();
system.analytics.reload();
FB.XFBML.parse($('#bottom_flap .fb_like').get(0)); // facebook
$.ajax({ url: 'http://platform.twitter.com/widgets.js', dataType: 'script', cache: true });
$('#lightbox .close').live('click', function(){
$.modal.close();
});
}
// SNIPPET:
function on_lightbox_open() {
alert('i work now');
system.contextBrowserInit();
updateUrl(year + '/' + month + '/' + id);
ads.reload();
system.analytics.reload();
FB.XFBML.parse($('#bottom_flap .fb_like').get(0)); // facebook
$.ajax({ url: 'http://platform.twitter.com/widgets.js', dataType: 'script', cache: true });
$('#lightbox .close').live('click', function(){
$.modal.close();
});
}
// SNIPPET:
// ==UserScript==
// @name MyTestScript
// @require http://code.jquery.com/jquery-1.7.1.min.js
// @namespace NRA
// @include http://www.mysamplewebsite.com/view/*
// ==/UserScript==
$(document).ajaxSuccess(function(e, xhr) {
alert(\"ajax success hit!\");
// I will do my other handling here
});
// SNIPPET:
<!DOCTYPE HTML>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>DOM</title>
<meta name=\"author\" content=\"meme\" />
<!-- Date: 2012-02-21 -->
<script type=\"text/javascript\" src=\"jquery-1.7.1.js\"></script>
<script type=\"text/javascript\" src=\"ui/jquery.ui.core.js\"></script>
<script type=\"text/javascript\" src=\"ui/jquery.ui.widget.js\"></script>
<script type=\"text/javascript\" src=\"ui/jquery.ui.mouse.js\"></script>
<script type=\"text/javascript\" src=\"ui/jquery.ui.draggable.js\"></script>
<script type=\"text/javascript\" src=\"dom.js\"></script>
</head>
<body oncontextmenu=\"return false\" onselectstart=\"return false\">
</body>
</html>
// SNIPPET:
var start = function () {
var div = document.createElement('div');
div.style.width = '50px';
div.style.height = '50px';
div.style.border = '1px solid black';
div.id = 'drag';
document.body.appendChild(div);
$('#drag').draggable({
stop: function(event, ui) {
var xPos = event.pageX/2;
var yPos = event.pageY/2;
this.style.left = xPos + 'px';
this.style.top = yPos + 'px';
var start = new Date().getTime();
while ((new Date().getTime() - start) < 1000){
// Do nothing
}
}}
);
}
window.onload = start;
// SNIPPET:
$(function(){
function someFunc(){
/*do something*/
};
.............
});
// SNIPPET:
function test(){
$.fn.someFunc();
}
// SNIPPET:
<script type=\"text/javascript\" src=\"js/jquery.easing.1.3.js\"></script>
<script type=\"text/javascript\">
$(function() {
$('ul.side-nav a').bind('click',function(event){
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1500,'easeInOutExpo');
event.preventDefault();
});
});
</script>
// SNIPPET:
case \"O\":
if(document.URL.indexOf(\"&screen=place&try=confirm\") >= 0){
document.forms[0].submit.click();
}
else if(document.URL.indexOf(\"screen=place&target=\") >= 0){
insertUnit(document.units.light,30); document.units.attack.click();
}
else if(document.URL.indexOf(\"&screen=place\") >= 0){
SWITCH TO NEXT PAGE
}
break;
// SNIPPET:
$(document).ready(function () {
$(\".various\").fancybox({
maxWidth: 800,
maxHeight: 600,
fitToView: true,
width: '70%',
height: '70%',
autoSize: false,
closeClick: false,
openEffect: 'none',
closeEffect: 'none'
});
});
// SNIPPET:
<meta name=\"viewport\" content=\"user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1\">
// SNIPPET:
$('#test').hover(
function () {
$(this).append('Blah');
}
);
// SNIPPET:
Blah
// SNIPPET:
#test
// SNIPPET:
#test
// SNIPPET:
Blah
// SNIPPET:
#test
// SNIPPET:
var express = require('express'),
routingProxy = require('http-proxy').RoutingProxy(),
app = express.createServer();
var apiVersion = 1.0,
apiHost = my.host.com,
apiPort = 8080;
function apiProxy(pattern, host, port) {
return function(req, res, next) {
if (req.url.match(pattern)) {
routingProxy.proxyRequest(req, res, {host: host, port: port});
} else {
next();
}
}
}
app.configure(function () {
// API proxy middleware
app.use(apiProxy(new RegExp('\\/' + apiVersion + '\\/.*'), apiHost, apiPort));
// Static content middleware
app.use(express.methodOverride());
app.use(express.bodyParser());
app.use(express.static(__dirname));
app.use(express.errorHandler({
dumpExceptions: true,
showStack: true
}));
app.use(app.router);
});
app.listen(3000);
// SNIPPET:
<span data-bind=\"text: name\"/>
<input data-bind=\"value: name\" />
// SNIPPET:
if (r == true) {
window.location.href = ('http://www.myurl.com/pubs_delete.php?=id'.a_href)
};
// SNIPPET:
[ { key: \"Id\" },
{ key: \"Username\" },
{ key: \"Age\" }
],
// SNIPPET:
[{
\"Employee1\":
{
\"ID\": 43036,
\"Name\": XYZ,
\"Age\": 21
},
\"Employee2\":
{
\"ID\": 30436,
\"Name\": MNP,
\"Age\": 23
}
}]
// SNIPPET:
[
{
\"ID\": 43036,
\"Name\": XYZ,
\"Age\": 21
},
{
\"ID\": 30436,
\"Name\": MNP,
\"Age\": 23
}
]
// SNIPPET:
<tr>
// SNIPPET:
<td>
// SNIPPET:
class=\"myClass\"
// SNIPPET:
<tr>
<td class=\"myClass\"></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
// SNIPPET:
<tr>
// SNIPPET:
td.myClass
// SNIPPET:
Math.random()
// SNIPPET:
function constrain(min, max){
return Math.round(Math.random() * (max - min) + min)
}
// SNIPPET:
var param =\"&usuario=\"+usuario+\"&nivel=\"+nivel+gano+porc_gano+gasto+porc_gasto+tengo+porc_tengo+debo+ porc_debo+plazo_debo;
var s = document.createElement(\"script\");
s.type = \"text/javascript\"; s.async = true;
s.src = server_direction +\"setMisDatos?callback=respuestaGuardarMisDatos&param=\"+encodeURIComponent(param);
var h = document.getElementsByTagName(\"script\")[0];
h.parentNode.insertBefore(s, h); //or h.appendChild(s);
// SNIPPET:
var plazo_debo_casa1 = (getValor(\"plazo_debo_casa1\"));
var plazo_debo_casa2 = (getValor(\"plazo_debo_casa2\"));
var plazo_debo_casa3 = (getValor(\"plazo_debo_casa3\"));
var plazo_debo_prestamo1 = (getValor(\"plazo_debo_prestamo1\"));
var plazo_debo_prestamo2 = (getValor(\"plazo_debo_prestamo2\"));
var plazo_debo_prestamo3 = (getValor(\"plazo_debo_prestamo3\"));
var plazo_debo =\"&plazo_debo_casa1=\"+plazo_debo_casa1+\"&plazo_debo_casa2=\"+plazo_debo_casa2+\"&plazo_debo_casa3=\"+plazo_debo_casa3+\"&plazo_debo_prestamo1=\"+plazo_debo_prestamo1+\"&plazo_debo_prestamo2=\"+plazo_debo_prestamo2+\"&plazo_debo_prestamo3=\"+plazo_debo_prestamo3;
// SNIPPET:
http://www.mirodinero.com:8080/mirodinero-war/setMisDatos?callback=respuestaGuardarMisDatos&param=%26usuario%3DIsa%20Mirodinero%26nivel%3D109%26gano_sal_neto%3D211113.45%26gano_sal_prof%3D2480%26gano_monet%3D0%26gano_renta_fija%3D0%26gano_renta_vble%3D0%26gano_inmuebles%3D2226.75%26gano_otros%3D2223.73%26gano_otros_ing%3D2411.12%26porc_gano_monet%3D0%26porc_gano_rentaf%3D0%26porc_gano_rentav%3D0%26porc_gano_inm%3D2%26porc_gano_otros%3D2%26porc_gano_otros_ing%3D1%26gasto_casa1%3D1306.46%26gasto_casa2%3D2402.38%26gasto_casa3%3D3999.57%26gasto_prestamo1%3D93475.58%26gasto_prestamo2%3D7325.88%26gasto_prestamo3%3D34090.9%26gasto_tarjetas%3D29443.2%26gasto_ibi%3D5670%26gasto_imp_otros%3D6780%26gasto_seg_inm%3D1320%26gasto_seg_pens%3D3451.22%26gasto_seg_vida%3D2330%26gasto_seg_plan%3D34230%26gasto_seg_medico%3D21220%26gasto_seg_coche%3D220%26gasto_luz%3D620%26gasto_agua%3D4550%26gasto_gas%3D320%26gasto_telef_f%3D22320%26gasto_telef_m%3D2350%26gasto_internet%3D20%26gasto_tv%3D3450%26gasto_hogar%3D20%26gasto_comida%3D20%26gasto_cenas_copas%3D20%26gasto_viajes%3D20%26gasto_vacaciones%3D220%26gasto_mobiliario%3D220%26gasto_ropa%3D2320%26gasto_transp%3D230%26gasto_otros%3D3620%26gasto_colegios%3D240%26gasto_univ%3D340%26gasto_master%3D2230%26gasto_otros_gastos%3D7323433%26porc_gasto_tarjetas%3D0%26porc_gasto_ibi%3D0%26porc_gasto_trib%3D0%26porc_gasto_seg_inm%3D0%26porc_gasto_seg_pens%3D0%26porc_gasto_seg_vida%3D2%26porc_gasto_seg_plan%3D2%26porc_gasto_seg_med%3D0%26porc_gasto_seg_coche%3D0%26porc_gasto_sum_luz%3D2%26porc_gasto_sum_agua%3D2%26porc_gasto_sum_gas%3D0%26porc_gasto_sum_teleff%3D0%26porc_gasto_sum_telefm%3D0%26porc_gasto_sum_int%3D0%26porc_gasto_sum_tv%3D0%26porc_gasto_nivel_hogar%3D0%26porc_gasto_nivel_comida%3D0%26porc_gasto_nivel_cenas%3D0%26porc_gasto_nivel_viajes%3D0%26porc_gasto_nivel_vacac%3D0%26porc_gasto_nivel_mob%3D0%26porc_gasto_nivel_ropa%3D20%26porc_gasto_nivel_transp%3D30%26porc_gasto_nivel_otros%3D30%26porc_gasto_colegios%3D2%26porc_gasto_univ%3D0%26porc_gasto_master%3D0%26porc_gasto_otros_gastos%3D23%26tengo_casa1%3D1231.11%26tengo_casa2%3D10000%26tengo_casa3%3D22240%26tengo_otras%3D23560%26tengo_monetario%3D1212.34%26tengo_planpensiones%3D23230%26tengo_otros%3D23330%26porc_tengo_casa1%3D1%26porc_tengo_casa2%3D0%26porc_tengo_casa3%3D2%26porc_tengo_otras%3D0%26porc_tengo_monet%3D0%26porc_tengo_plan%3D0%26porc_tengo_otros%3D0%26debo_casa1%3D4340%26debo_casa2%3D23450%26debo_casa3%3D23430%26debo_prestamo1%3D23330%26debo_prestamo2%3D6871.11%26debo_prestamo3%3D11340%26debo_tarjetas%3D61340%26porc_debo_casa1%3D30%26porc_debo_casa2%3D10%26porc_debo_casa3%3D12%26porc_debo_prestamo1%3D1%26porc_debo_prestamo2%3D12%26porc_debo_prestamo3%3D1%26porc_debo_tarjetas%3D4%26plazo_debo_casa1%3D230%26plazo_debo_casa2%3D450%26plazo_debo_casa3%3D122%26plazo_debo_prestamo1%3D3%26plazo_debo_prestamo2%3D12%26plazo_debo_prestamo3%3D4
// SNIPPET:
function guardaLoQueGano(){
var nivel = parseInt(document.getElementById('progreso_nivel_total').style.marginLeft);
/*idUsusario*/
var usuario = miGetElementsByClassName('title', document.getElementById('block-user-1'))[0].innerHTML;
/*gano*/
var gano_sal_neto = getValor(\"gano_sal_neto\");
var gano_sal_prof = getValor(\"gano_sal_prof\");
var gano_monet = getValor(\"gano_monet\");
var gano_renta_fija = (getValor(\"gano_renta_fija\"));
var gano_renta_vble = (getValor(\"gano_renta_vble\"));
var gano_inmuebles = (getValor(\"gano_inmuebles\"));
var gano_otros = (getValor(\"gano_otros\"));
var gano_otros_ing = (getValor(\"gano_otros_ing\"));
/*gano porcentajes*/
var porc_gano_monet = getValor(\"porc_gano_monet\");
var porc_gano_rentaf = getValor(\"porc_gano_rentaf\");
var porc_gano_rentav = getValor(\"porc_gano_rentav\");
var porc_gano_inm = getValor(\"porc_gano_inm\");
var porc_gano_otros = getValor(\"porc_gano_otros\");
var porc_gano_otros_ing = getValor(\"porc_gano_otros_ing\");
var param = \"&usuario=\" + usuario + \"&nivel=\" + nivel + \"&gano_sal_neto=\" + gano_sal_neto + \"&gano_sal_prof=\" + gano_sal_prof + \"&gano_monet=\" + gano_monet + \"&gano_renta_fija=\" + gano_renta_fija + \"&gano_renta_vble=\" + gano_renta_vble + \"&gano_inmuebles=\" + gano_inmuebles + \"&gano_otros=\" + gano_otros + \"&gano_otros_ing=\" + gano_otros_ing + \"&porc_gano_monet=\" + porc_gano_monet + \"&porc_gano_rentaf=\" + porc_gano_rentaf + \"&porc_gano_rentav=\" + porc_gano_rentav + \"&porc_gano_inm=\" + porc_gano_inm + \"&porc_gano_otros=\" + porc_gano_otros + \"&porc_gano_otros_ing=\" + porc_gano_otros_ing;
var s = document.createElement(\"script\");
s.type = \"text/javascript\"; s.async = true;
s.src = direccion_servidor + \"setMisDatos?callback=respuestaGuardarMisDatos&param=\" + encodeURIComponent(param);
var h = document.getElementsByTagName(\"script\")[0];
// adesso h.appendChild(s);
h.parentNode.insertBefore(s, h);
alert(\"Datos de lo que gano actualizados correctamente\");
}
// SNIPPET:
<div id=\"lo_que_gano\" class=\"mis_datos\" style=\"display:none\">
<div class=\"generic todo_izq\">
<div class=\"ancho_lado_izq generic\">
<div class=\"texto_form generic\">Salario neto</div>
<div class=\"generic\">
<input class=\"numero\" id=\"gano_sal_neto\" type=\"text\" value=\"0\" onchange=\"calculoGano()\" onkeypress=\"tecla('gano_sal_prof', event);\"/></br>
</div>
</div>
//all the values that has to be stored
</div>
<div class=\"generic botonGuardar\">
<input type=\"button\" value=\"Guardar\" onclick=\"return guardaTodo()\"/>
</div>
</div>
// SNIPPET:
public float getTotalGano() {
float res = user.getGanoMonet() + user.getGanoRentaFija() + user.getGanoRentaVble() + user.getGanoInmuebles() + user.getGanoOtros() + user.getGanoSalNeto() + user.getGanoSalProf() + user.getGanoOtrosIng();
return res;
}
// SNIPPET:
public void ejecutar() {
boolean existe = true;
DatosUsuario datosUser = datosUsuarioFacade.findById(atributosUsuario.getIdUsuario());
if (datosUser != null) {
List<Cartera> lc = carteraFacade.findByIdUsuario(atributosUsuario.getIdUsuario());
Calculos c = new Calculos(datosUser, accionesDatosFacade, fondosDatosFacade, bonosDatosFacade, lc);
ahorroLiquido = c.getTengoDisponible() / c.getTotalGasto();
ingresoAnual = c.getTotalGano(); /*this is line 65 */
diferenciaGanoGasto = c.getSupDefTotal();//indica lo que gano menos lo que gasto
modificarAtributos(c, datosUser);
}
// SNIPPET:
2012-05-22 11:10:46 CESTLOG: could not receive data from client: Unknown winsock error 10061
2012-05-22 11:10:46 CESTLOG: unexpected EOF on client connection
2012-05-22 11:19:12 CESTLOG: CreateProcess call failed: Unknown winsock error 10004 (error code 1115)
2012-05-22 11:19:12 CESTLOG: could not fork autovacuum worker process: Unknown winsock error 10004
// SNIPPET:
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<title>AJAX with PHP, 2nd Edition: Quickstart</title>
<script type=\"text/javascript\" src=\"quickstart.js\"></script>
</head>
<body onload='process()'>
Server wants to know your name:
<input type=\"text\" id=\"myName\" />
<div id=\"divMessage\" />
</body>
</html>
// SNIPPET:
var xmlHttp = createXmlHttpRequestObject();
function createXmlHttpRequestObject() {
var xmlHttp;
if(window.ActiveXObject) {
try {
xmlHttp = new ActiveXObject(\"Microsoft.XMLHTTP\");
}
catch (e) {
xmlHttp = false;
}
}
else
{
try {
xmlHttp = new XMLHttpRequest();
}
catch (e) {
xmlHttp = false;
}
}
if (!xmlHttp)
alert(\"Error creating the XMLHttpRequest object.\");
else
return xmlHttp;
}
function process(){
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
name = encodeURIComponent(
document.getElementById(\"myName\").value);
xmlHttp.open(\"GET\", \"quickstart.php?name=\" + name, true);
xmlHttp.onreadystatechange = handleServerResponse;
xmlHttp.send(null);
}
else
setTimeout('process()', 1000);
}
function handleServerResponse() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
xmlResponse = xmlHttp.responseXML;
xmlDocumentElement = xmlResponse.documentElement;
helloMessage = xmlDocumentElement.firstChild.data;
document.getElementById(\"divMessage\").innerHTML =
'<i>' + helloMessage
+ '</i>';
setTimeout('process()', 1000);
}
else {
alert(\"There was a problem accessing the server: \" +
xmlHttp.statusText);
}
}
}
// SNIPPET:
<?php
header('Content-Type: text/xml');
echo '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>';
echo '<response>';
$name = $_GET['name'];
$userNames = array('YODA', 'AUDRA', 'BOGDAN', 'CRISTIAN');
if (in_array(strtoupper($name), $userNames))
echo 'Hello, master ' . htmlentities($name) . '!';
else if (trim($name) == '')
echo 'Stranger, please tell me your name!';
else
echo htmlentities($name) . ', I don\\'t know you!';
echo '</response>';
?>
// SNIPPET:
//The following scales images proportionally to fit within the #slider div
$('#slider ul li img').each(function() {
var maxWidth = $('#slider').outerWidth(false); // Max width for the image
var maxHeight = $('#slider').outerHeight(false); // Max height for the image
var ratio = 0; // Used for aspect ratio
var width = $(this).width(); // Current image width
var height = $(this).height(); // Current image height
// Check if the current width is larger than the max
if(width > maxWidth){
ratio = maxWidth / width; // Ratio for scaling image
$(this).css(\"width\", maxWidth); // Set new width
$(this).css(\"height\", height * ratio); // Scale height based on ratio
height = height * ratio; // Reset height to match scaled image
}
var width = $(this).width(); // Current image width
var height = $(this).height(); // Current image height
// Check if current height is larger than max
if(height > maxHeight){
ratio = maxHeight / height; // Ratio for scaling image
$(this).css(\"height\", maxHeight); // Set new height
$(this).css(\"width\", width * ratio); // Scale width based on ratio
width = width * ratio; // Reset width to match scaled image
}
});
initialize(); //initializes the jCarousel Lite carousel
// SNIPPET:
<script type=\"text/javascript\">
var auto_refresh = setInterval(function() {
<? if ($lim >= 5)
$lim = 0;
else
$lim = $lim + 2;
if ($cnt == 1){
$lim = 0;
$cnt += 1;
} ?>
$('#news').load('update.php?lim=<? echo $lim ?>');
}, 10000); // refresh every 10000 milliseconds
</script>
// SNIPPET:
$lim=$_GET['lim'];
// SNIPPET:
function player(playlist){
...
var tracks = [];
this.start = function() {
...
$.getJSON(playlist, function(data){
$.each(data.tracks, function(key,value){
var track_info = function(info){return info}(value);
tracks.push(track_info);
});
console.log(\"from .getJSON function\");
console.log(tracks);
});
console.log(\"outside .getJSON function\");
console.log(tracks);
...
};
...
$(document).ready(function(){
var the_player = new player(playlist);
the_player.start();
)};
// SNIPPET:
outside .getJSON function
[]
from .getJSON function
[Object, Object, Object]
// SNIPPET:
<script type=\"text/javascript\"><!--
$('#aboutLink').mouseover(function() {$('#aboutMenu1').slideDown('fast');
$('#aboutLink').css(\"color\", \"#ff297b\");});
--></script>
// SNIPPET:
var $data = jQuery.makeArray(attachmentId = attachmentID, action = 'rename', oldName = filename, newName, bucketName, oldFolderName, newFolderName, projectId = PID, businessId = BID);
var serializedData = $data.serializeArray();
//alert(theurl);
$.ajax({ type: \"post\", url: theurl, data: serializedData, dataType: 'json', success: reCreateTree });
// SNIPPET:
$js = \"<script>$(function(){\\$('#slider').anythingSlider({autoPlay: true, delay: 5000, animationTime: 400, easing: \\\"easeInOutExpo\\\"});});</script>\";
// SNIPPET:
id
// SNIPPET:
name
// SNIPPET:
<input type=\"checkbox\" class=\"active\" name=\"active<?php echo $id; ?>\" id=\"active<?php echo $id; ?>\" <?php if ($active == 1): ?>checked=\"checked\"<?php endif; ?> value=\"<?php echo $id; ?>\">
// SNIPPET:
<input type=\"checkbox\" class=\"active\" name=\"active5\" id=\"active5\" checked=\"checked\" value=\"5\">
// SNIPPET:
name
// SNIPPET:
name
// SNIPPET:
$(\"input.active\").click(function() {
// store the values from the form checkbox box, then send via ajax below
var check_active = $(this).is(':checked') ? 1 : 0;
var check_id = $(this).attr('value');
console.log(check_active);
console.log(check_id);
$.ajax({
type: \"POST\",
url: \"http://nowfoods.marketspacecom.com/nextstep/ajax.php\",
data: {id: check_id, active: check_active},
success: function(){
$('form#submit').hide(function(){$('div.success').fadeIn();});
}
});
return true;
});
// SNIPPET:
<?php
include(\"dbinfo.inc.php\");
mysql_connect($server,$username,$password);
@mysql_select_db($database) or die( \"Unable to select database\");
// CLIENT INFORMATION
$active = mysql_real_escape_string($_POST['active']);
$id = mysql_real_escape_string($_POST['id']);
$addEntry = \"UPDATE entries SET active = '$active' WHERE id = '$id'\";
mysql_query($addEntry) or die(mysql_error());
mysql_close();
// SNIPPET:
for(index = 0; index < grid_obj.getStore().getCount(); index++){
if(sm.isSelected(index)){
selected_row = index;
record = grid_obj.getStore().getAt(index);
record_data = record.data.field;
s_record = record_data.toString().replace('(','').replace(')','').split(',');
}
}
// SNIPPET:
@-webkit-keyframes fadeIn {
0% { opacity: 0; }
100% { opacity: 1; }
}
// SNIPPET:
$(\"body\").delegate(\"[data-action]\", \"click\", function(){
var action = $(this).attr(\"data-action\");
//route action to appropriate function
});
// SNIPPET:
<!DOCTYPE html>
<html>
<head>
<script type=\"text/javascript\">
function timeMsg()
{
var t=setTimeout(\"enterquestion()\",900000);
}
function enterquestion()
{
document.getElementById(\"questions\").innerHTML += '<p>' + document.getElementById(\"question\").value;
}
</script>
</head>
<body>
<h1>Testing Website</h1>
<p id=\"questions\"></p>
<input type=\"text\" name=\"question\" id=\"question\" />
<button type=\"button\" onclick=\"timeMsg()\">Enter question</button>
</body>
</html>
// SNIPPET:
<script>
function goToo(url,idd){
alert(idd);
if (idd==\"onlyMe\")
window.location=url;
}
</script>
<div id=\"onlyMe\" onclick=\"javascript:goToo('http://www.google.com', this.id)\" style=\"<-index:-150\">
<form><input type=\"text\" name=\"coap\"></form>
<h3>This is an element where click should work!</h3>
<div id=\"notME\">
<h3>In this point it should not work!</h3>
</div>
</div>
// SNIPPET:
<a>
// SNIPPET:
<a>
// SNIPPET:
<ul id=\"navigation\">
<LI><A class=\"home selected-lice\"href=\"#header\">Home</A></LI>
<LI><A href=\"#header4\">Partners</A></LI>
<LI><A class=\"about\" href=\"#header5\">About Us</A></LI>
<LI><A class=\"contact\" href=\"#header6\">Contact Us</A></LI>
</ul><!-- end of #navigation -->
// SNIPPET:
Ext.create('Rally.data.WsapiDataStore', {
model: 'User Story',
autoLoad: true,
listeners: {
load: this._onArtifactsLoaded,
scope: this
}
});
// SNIPPET:
Ext.create('Rally.data.WsapiDataStore', {
model: 'Artifact',
autoLoad: true,
listeners: {
load: this._onArtifactsLoaded,
scope: this
}
});
// SNIPPET:
Uncaught TypeError: Cannot call method 'replace' of undefined sdk-debug.js:104071
Ext.define._buildTypeInfo sdk-debug.js:104071
Ext.define.getModels sdk-debug.js:104025
Ext.Array.each sdk-debug.js:956
Ext.define.getModels sdk-debug.js:104024
Ext.define.getModel sdk-debug.js:103985
Ext.define.load sdk-debug.js:104379
(anonymous function)
// SNIPPET:
view.unbindAll()
// SNIPPET:
x = function(d) { return d.x * width / mx; };
// later....
x({x: .9}); // call
// SNIPPET:
XMLHttpRequest cannot load .
Origin is not allowed by Access-Control-Allow-Origin.
// SNIPPET:
<a href=\"javascript:submitCompare()\" class=\"submit\">Compare</a>
function submitCompare()
{
document.myForm.action = \"anotherAction.php\";
document.myForm.onsubmit = function() {return countChecked()};
document.myForm.submit();
}
function countChecked()
{
var n = $(\".reports input:checked\").length;
if (n >= 3 ) {
alert ('You must select less than 3 reports.');
return false;
}
else return true;
}
// SNIPPET:
NSString *HTML = [NSString stringWithFormat:@\"<html> \\n\"
\"<head> \\n\"
\"<style type=\\\"text/css\\\"> \\n\"
\"@-webkit-keyframes fadeIn {from {opacity: 0;-webkit-transition: opacity;}to {opacity: 1;}} \\n\"
\"body {\\n\"
\"-webkit-animation-name:fadeIn;\\n\"
\"-webkit-animation-duration: 1.5s;\\n\"
...
// SNIPPET:
[mainWebView stringByEvaluatingJavaScriptFromString:@\"/*animate*/\"];
// SNIPPET:
canGoBack()
// SNIPPET:
goBack()
// SNIPPET:
function myFunction(objname) {
return myjsonobj.objname;
}
// SNIPPET:
1 2 3
2 4 6
3 6 9
// SNIPPET:
<%@page contentType=\"text/html\" pageEncoding=\"UTF-8\"%>
<!DOCTYPE html>
<html>
<body>
<h1>multiplication table</h1>
<form action=\"form_action.jsp\" method=\"get\">
Size: <input type=\"size\" name=\"size\" size=\"35\" /><br />
<input type=\"submit\" value=\"Submit\" />
</form>
<p>Click on the submit button, and the input will be sent to a page
on the server called \"form_action.jsp\".</p>
</body>
</html>
// SNIPPET:
<%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\"
pageEncoding=\"UTF-8\"%>
<head>
<title>Calculation from a form</title>
</head>
<body>
<div>Calculation</div>
<table border=\"Calculation\">
<%
String temp = request.getParameter(\"number\");
int x = Integer.parseInt(temp);
String table = \"<table border='1' id='mytable'>\";
for (int row = 1; row < 11; row++) {
%>
<tr>
<%
for (int column = 1; column < 11; column++) {
%>
<td><tt><%=row * column%></tt></td>
<%
}
%>
</tr>
<%
}
%>
</table>
</body>
// SNIPPET:
document
// SNIPPET:
div
// SNIPPET:
Uncaught TypeError: Cannot set property 'display' of undefined
// SNIPPET:
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />
<meta http-equiv=\"content-language\" content=\"en-us\" />
<meta http-equiv=\"cache-control\" content=\"no-cache\" />
<meta http-equiv=\"pragma\" content=\"no-cache\" />
<meta name=\"keywords\" content=\"\" />
<meta name=\"description\" content=\"\" />
<meta name=\"author\" content=\"\" />
<meta name=\"copyright\" content=\"&copy; 2012\" />
<meta name=\"robot\" content=\"noindex, nofollow\" />
<title>js features</title>
<base href=\"\" />
<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"\" />
<style type=\"text/css\" media=\"all\">
</style>
</head>
<body>
<div id=\"container\">
<div id=\"header\"></div>
<div id=\"content\">
<p>This is sample content</p>
</div>
<div id=\"footer\">&copy; 2012</div>
</div>
<script type=\"text/javascript\">
function hideMe() {
//hide all div elements
var div = document.getElementsByTagName(\"div\");
for(var i = 0; i < div.length; i = i + 1) {
div.style.display=\"none\";
}
}
</script>
<p onClick=\"hideMe();\">Click to hide</p>
</body>
</html>
// SNIPPET:
//open the printing window
win2 = window.open('printingPage.aspx');
//set focus back to opener page
win2.blur();
window.focus();
window.document.focus();
// SNIPPET:
chrome.tabs.getSelected(null,function(tab) {
var tablink = tab.url;
});
document.write('https://chart.googleapis.com/chart?chs=100x100&cht=qr&chl=' + tablink);
// SNIPPET:
{
\"name\": \"Qrit\",
\"version\": \"1.0\",
\"manifest_version\": 2,
\"description\": \"Instantly creates a QR Code that links to the current page.\",
\"browser_action\": {
\"default_icon\": \"icon.png\",
\"default_popup\": \"popup.html\"
},
\"permissions\": [
\"tabs\"
]
}
// SNIPPET:
function Point3DToScreen2D(point3D){
var screenX = 0;
var screenY = 0;
var inputX = point3D.x - camera.position.x;
var inputY = point3D.y - camera.position.y;
var inputZ = point3D.z - camera.position.z;
var aspectRatio = renderer.domElement.width / renderer.domElement.height;
screenX = inputX / (-inputZ * Math.tan(camera.fov/2));
screenY = (inputY * aspectRatio) / (-inputZ * Math.tan(camera.fov / 2));
screenX = screenX * renderer.domElement.width;
screenY = renderer.domElement.height * (1-screenY);
return {x: screenX, y: screenY};
}
// SNIPPET:
function languageChange()
{
var lang = $('#websites1 option:selected').val();
<?php $_SESSION['SESS_LANGUAGE']?> = lang;
alert(<?php echo $_SESSION['SESS_LANGUAGE']?>);
}
// SNIPPET:
<script src='scene.json'></script>
<script>
var x = scene.x;
</script>
// SNIPPET:
{\"scene\": {
\"x\": 0,
\"y\": 0,
\"w\": 11000,
\"h\": 3500,
}}
// SNIPPET:
<title>
// SNIPPET:
My Single Page App
// SNIPPET:
pushState
// SNIPPET:
hashChange
// SNIPPET:
http://www.mysinglepageapp.com/modified/url
// SNIPPET:
int isAnyNonProdTaskActive = _nonProduction.IsAnyTaskActive(UserIDFromDB);
if (isAnyNonProdTaskActive > 0)
{
//Displays and Logs Message
_loggerDetails.LogMessage = \"EmployeeQuotient.Production.Page_Load() One NonProduction incomplete task found, NonProductionTimeEntryID : \" + isAnyNonProdTaskActive.ToString();
_writeLog.LogDetails(_loggerDetails.LogLevel_Info, _loggerDetails.LogMessage);
Session[\"TaskActiveNonProd\"] = isAnyNonProdTaskActive;
Page page = HttpContext.Current.CurrentHandler as Page;
//Displays and Logs Message
_loggerDetails.LogMessage = \"EmployeeQuotient.Production.Page_Load() Opening ElapsedClockNonProd.aspx to complete the incomplete task id :\" + isAnyNonProdTaskActive.ToString();
_writeLog.LogDetails(_loggerDetails.LogLevel_Info, _loggerDetails.LogMessage);
ScriptManager.RegisterStartupScript(page, page.GetType(), \"OpenModalDialog\", \"<script type=text/javascript>window.showModalDialog('ElapsedClockNonProd.aspx?code=\" + isAnyNonProdTaskActive.ToString() + \"', null, 'unadorned:yes ;resizable:0 ;dialogWidth:300px ;dialogHeight:300px ;status:no ;scroll:no ;status=no;'); </script>\", false);
}
// SNIPPET:
function doSubmit() {
var checkbox = document.getElementById(\"terms\");
if (!checkbox.checked) {
alert(\"error message here!\");
return;
}
document.getElementById(\"f\").submit();
}​
// SNIPPET:
<input id=\"proceed\" onclick=\"doSubmit()\" type=\"submit\" value=\"${fn:escapeXml(submit_label)}\" />
// SNIPPET:
$(function() {
var imgs = ['http://www.academy-florists.com/images/shop/thumbnails%5CValentines_Day_flowers.jpg', 'http://www.everythingbuttheprincess.com/assets/images/babies-in-bloom-fuchsia-flower_thumbnail.jpg', 'http://www.behok.ru/i/a/cat/gerbera.jpg', 'http://www.thebutterflygrove.com/images/thumbnails/0/200/200/thumbnail_flower-decor-makpk.jpg', 'http://gameinfestedent.com/gallery_photo/medium_image/image1322820610_MainPurpleOrchids3_1a.jpg'];
var maximages = imgs.length; //No of Images
Slider();
setInterval(Slider, 3000);
var prevIndex = 0, prevPrevIndex = 0;
function Slider() {
$('#imageSlide').fadeOut(\"slow\", function() {
do {
shuffleIndex = Math.floor(Math.random() * maximages);
} while(prevIndex == shuffleIndex || prevPrevIndex == shuffleIndex)
prevPrevIndex = prevIndex;
prevIndex = shuffleIndex;
$(\"#panel\").fadeIn(\"slow\").css('background', '#000');
$(this).attr('src', imgs[shuffleIndex]).fadeIn(\"slow\");
});
}
});
// SNIPPET:
<html>
<body>
<h3>Table 1</h3>
<table class=\"details\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\">
<tbody><tr>
<th>1</th>
<td>2</td>
</tr>
</tbody></table>
<h3>Table 2</h3>
<table class=\"details\" border=\"1\">
<tbody><tr>
<th>1</th>
<td>2</td>
</tr><tr>
<th>3</th>
<td>4</td>
</tr>
</tbody></table>
</body>
</html>
// SNIPPET:
var elmDeleted = document.getElementsByClassName('details').item(0);
elmDeleted.parentNode.removeChild(elmDeleted);
// SNIPPET:
var elmDeleted = document.getElementsByClassName('details').item(1);
elmDeleted.parentNode.removeChild(elmDeleted);
// SNIPPET:
var elmDeleted = document.getElementsByClassName('details').item(0);
elmDeleted.parentNode.removeChild(elmDeleted);
var elmDeleted = document.getElementsByClassName('details').item(1);
elmDeleted.parentNode.removeChild(elmDeleted);
// SNIPPET:
$.ajax
// SNIPPET:
$.ajax({
url : 'http://tinysong.com/s/Beethoven?format=json&key='+key,
type : 'get',
dataType : 'jsonp',
succes : function(response){
console.log(response);
$('.content').append(response);
},
error: function(error){
console.warn('ERROR');
console.warn(error);
}
});
// SNIPPET:
key
// SNIPPET:
var fadeEffect=function(){
return{
init:function(id, flag, target){
this.elem = document.getElementById(id);
clearInterval(this.elem.si);
this.target = target ? target : flag ? 100 : 0;
this.flag = flag || -1;
this.alpha = this.elem.style.opacity ? parseFloat(this.elem.style.opacity) * 100 : 0;
this.si = setInterval(function(){fadeEffect.tween()}, 20);
},
tween:function(){
if(this.alpha == this.target){
clearInterval(this.elem.si);
}else{
var value = Math.round(this.alpha + ((this.target - this.alpha) * .05)) + (1 * this.flag);
this.elem.style.opacity = value / 100;
this.elem.style.filter = 'alpha(opacity=' + value + ')';
this.alpha = value
}
}
}
}();
// SNIPPET:
this.target = target ? target : flag ? 100 : 0;
// SNIPPET:
function OnChange(dropdown){
var myindex = dropdown.selectedIndex;// This prints correctly
alert(\"Index : \"+document.getElementById(\"batches\").selectedIndex);// This is always 0 no metter what selects
}
<select name='batches' id='batches' onchange='OnChange(this);'>
<option value = \"1\">1</option>
<option value = \"2\">2</option>
<option value = \"3\">3</option>
</select>
// SNIPPET:
portletSession
// SNIPPET:
portletSession
// SNIPPET:
PortletSession portletSession = request.getPortletSession();
portletSession.setAttribute(\"noExist\", noExist);
// SNIPPET:
echo '<div class=product_name><a href=\"edit_order.php?order_number='.$order_numbers.'&product_id='.$row['id'].'&quantity='.$row['quantity'].'&sale_price='.$row['sale_price'].'&id='.$row['order_product_id'].'\" style=\"text-decoration: none\" title=\"View Details\"><h3>'.$row['productname'].'</h3></div>
<div class=quantity><h3>'.$row['quantity'].'</h3></div>
<div class=sale_price><h3>'.$row['sale_price'].'</h3></div></a>';
// SNIPPET:
<script type=\"text/javascript\" src=\"jquery/jquery-1.8.0.min.js\"></script>
<script src=\"ui/jquery.ui.core.js\"></script>
<script src=\"ui/jquery.ui.widget.js\"></script>
<script src=\"ui/jquery.ui.mouse.js\"></script>
<script src=\"ui/jquery.ui.draggable.js\"></script>
<script src=\"ui/jquery.ui.position.js\"></script>
<script src=\"ui/jquery.ui.resizable.js\"></script>
<script src=\"ui/jquery.ui.dialog.js\"></script>
<script>
$(function() {
$('.dialog').dialog({
modal: true,
height: 200,
autoOpen: false,
closeOnEscape: true,
hide: \"slide\",
open: function(event, ui) {
var url = $('.header a').attr('href');
alert(url);
$(\".dialog\").load(url); //use the previously saved id
},
close: function(event, ui) {
alert(\"ali\");
$(this).dialog('destroy').remove();
}
});
$('.header a').bind(\"click\", function(event) {
event.preventDefault();
$('.dialog').dialog('open');
});
});
</script>
// SNIPPET:
<script type=\"text/javascript\" src=\"jquery/ko.js\"></script>
<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js\"></script>
<script src=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js\"></script>
<script>
//custom binding to initialize a jQuery UI button
ko.bindingHandlers.jqButton = {
init: function(element, valueAccessor) {
var options = ko.utils.unwrapObservable(valueAccessor()) || {};
//handle disposal
ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
$(element).button(\"destroy\");
});
$(element).button(options);
}
};
ko.bindingHandlers.showModal = {
init: function(element, valueAccessor) {
var value = valueAccessor();
$(element).dialog({
close: function() {
if (ko.isWriteableObservable(value)) {
value(null);
}
}
});
//handle disposal
ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
$(element).dialog(\"destroy\");
});
},
update: function(element, valueAccessor, allBindingsAccessor, viewModel) {
var value = ko.utils.unwrapObservable(valueAccessor());
$(element).dialog(value ? \"open\" : \"close\");
}
};
//wrapper to an observable that requires accept/cancel
ko.protectedObservable = function(initialValue) {
//private variables
var _actualValue = ko.observable(initialValue);
var _tempValue = initialValue;
//dependentObservable that we will return
var result = ko.dependentObservable({
//always return the actual value
read: function() {
return _actualValue();
},
//stored in a temporary spot until commit
write: function(newValue) {
_tempValue = newValue;
}
});
//if different, commit temp value
result.commit = function() {
if (_tempValue !== _actualValue()) {
_actualValue(_tempValue);
}
};
//force subscribers to take original
result.reset = function() {
_actualValue.valueHasMutated();
_tempValue = _actualValue(); //reset temp value
};
return result;
};
function Item(id, name) {
this.id = id;
this.name = ko.protectedObservable(name);
}
function ViewModel() {
var self = this;
self.items = ko.observableArray([
new Item(1, \"one\"),
new Item(2, \"two\"),
new Item(3, \"three\")
]);
self.selectedItem = ko.observable();
self.accept = function() {
self.selectedItem().name.commit();
self.selectedItem(null);
};
self.cancel = function() {
self.selectedItem().name.reset();
self.selectedItem(null);
}
};
ko.applyBindings(new ViewModel());
$(\"#items\").delegate(\".item\", \"click\", function() {
var context = ko.contextFor(this);
context.$root.selectedItem(context.$data);
return false;
});
$(function() {
$('.dialog').dialog({
modal: true,
height: 200,
autoOpen: false,
closeOnEscape: true,
hide: \"slide\",
open: function(event, ui) {
var url = $('.header a').attr('href');
alert(url);
$(\".dialog\").load(url); //use the previously saved id
}
});
//alert('');
$('.header a').bind(\"click\", function(event) {
event.preventDefault();
$('.dialog').dialog('open');
//$('#dialog').load(url);
});
});
​</script>
<link href=\"style/style.css\" rel=\"stylesheet\" type=\"text/css\" />
<link href=\"style/base/jquery.ui.dialog.css\" rel=\"stylesheet\" type=\"text/css\" />
<div id=\"style\">
<div class=\"dialog\"></div>
<div id=header1><div class=header><div class=order_number><h1>Order Number:</h1><h3>1000</h3></div><div class=h2><h2>Products</h2></div><br />
<div class=container><div class=product_name><h3>Products</h3></div>
<div class=quantity><h3>Quantity</h3></div>
<div class=sale_price><h3>Sale Price</h3></div><div class=product_name><a href=\"edit_order.php?order_number=1000&product_id=14&quantity=8619&sale_price=98769&id=66\" style=\"text-decoration: none\" title=\"View Details\"><h3>Valium Diazepam</h3></a></div>
<div class=quantity><h3>8619</h3></div>
<div class=sale_price><h3>98769</h3></div><div class=product_name><a href=\"edit_order.php?order_number=1000&product_id=41&quantity=1264&sale_price=193248&id=77\" style=\"text-decoration: none\" title=\"View Details\"><h3>hhhha</h3></a></div>
<div class=quantity><h3>1264</h3></div>
<div class=sale_price><h3>193248</h3></div><div class=product_name><a href=\"edit_order.php?order_number=1000&product_id=37&quantity=-1435&sale_price=1302&id=78\" style=\"text-decoration: none\" title=\"View Details\"><h3>Tamezepaam</h3></a></div>
<div class=quantity><h3>-1435</h3></div>
<div class=sale_price><h3>1302</h3></div></div></div><div class=header><div class=order_number><h1>Order Number:</h1><h3>128</h3></div><div class=h2><h2>Products</h2></div><br />
<div class=container><div class=product_name><h3>Products</h3></div>
<div class=quantity><h3>Quantity</h3></div>
<div class=sale_price><h3>Sale Price</h3></div><div class=product_name><a href=\"edit_order.php?order_number=128&product_id=37&quantity=-1435&sale_price=1568&id=81\" style=\"text-decoration: none\" title=\"View Details\"><h3>Tamezepaam</h3></a></div>
<div class=quantity><h3>-1435</h3></div>
<div class=sale_price><h3>1568</h3></div></div></div><div class=header><div class=order_number><h1>Order Number:</h1><h3>200</h3></div><div class=h2><h2>Products</h2></div><br />
<div class=container><div class=product_name><h3>Products</h3></div>
<div class=quantity><h3>Quantity</h3></div>
<div class=sale_price><h3>Sale Price</h3></div><div class=product_name><a href=\"edit_order.php?order_number=200&product_id=37&quantity=-1435&sale_price=14400&id=70\" style=\"text-decoration: none\" title=\"View Details\"><h3>Tamezepaam</h3></a></div>
<div class=quantity><h3>-1435</h3></div>
<div class=sale_price><h3>14400</h3></div></div></div><div class=header><div class=order_number><h1>Order Number:</h1><h3>300</h3></div><div class=h2><h2>Products</h2></div><br />
<div class=container><div class=product_name><h3>Products</h3></div>
<div class=quantity><h3>Quantity</h3></div>
<div class=sale_price><h3>Sale Price</h3></div><div class=product_name><a href=\"edit_order.php?order_number=300&product_id=37&quantity=-1435&sale_price=1344&id=73\" style=\"text-decoration: none\" title=\"View Details\"><h3>Tamezepaam</h3></a></div>
<div class=quantity><h3>-1435</h3></div>
<div class=sale_price><h3>1344</h3></div><div class=product_name><a href=\"edit_order.php?order_number=300&product_id=14&quantity=8619&sale_price=1344&id=80\" style=\"text-decoration: none\" title=\"View Details\"><h3>Valium Diazepam</h3></a></div>
<div class=quantity><h3>8619</h3></div>
<div class=sale_price><h3>1344</h3></div></div></div></div>
</div>
// SNIPPET:
select
// SNIPPET:
select
// SNIPPET:
20
// SNIPPET:
selected=\"selected\"
// SNIPPET:
20
// SNIPPET:
Ember.js
// SNIPPET:
<table>
<tr>
<td style=\"font-weight: 700\" colspan=\"2\">
Color<input id=\"colorSortOrder\" type=\"hidden\" value=\"1\" />
</td>
</tr>
<tr>
<td>
<input id=\"radioRed\" type=\"radio\" name=\"Color\" value=\"R-\" />
<label for=\"radioRed\">
Red</label>
<input type=\"hidden\" value=\"Image1.jpg\" />
</td>
<td rowspan=\"3\">
<img />
</td>
</tr>
<tr>
<td>
<input id=\"radioOrange\" type=\"radio\" name=\"Color\" value=\"O-\" />
<label for=\"radioOrange\">
Orange</label>
<input type=\"hidden\" value=\"Image2.jpg\" />
</td>
</tr>
<tr>
<td>
<input id=\"radioBlue\" type=\"radio\" name=\"Color\" value=\"B-\" />
<label for=\"radioBlue\">
Blue</label>
<input type=\"hidden\" value=\"Image3.jpg\" />
</td>
</tr>
</table>
<table>
<tr>
<td style=\"font-weight: 700\" colspan=\"2\">
Size<input id=\"sizeSortOrder\" type=\"hidden\" value=\"2\" />
</td>
</tr>
<tr>
<td>
<input id=\"radioLarge\" type=\"radio\" name=\"Color\" value=\"LA-\" />
<label for=\"radioLarge\">
Large</label>
<input type=\"hidden\" value=\"Image4.jpg\" />
</td>
<td rowspan=\"3\">
<img />
</td>
</tr>
<tr>
<td>
<input id=\"radioMedium\" type=\"radio\" name=\"Color\" value=\"ME-\" />
<label for=\"radioMedium\">
Medium</label>
<input type=\"hidden\" value=\"Image5.jpg\" />
</td>
</tr>
<tr>
<td>
<input id=\"radioSmall\" type=\"radio\" name=\"Color\" value=\"SM-\" />
<label for=\"radioSmall\">
Small</label>
<input type=\"hidden\" value=\"Image6.jpg\" />
</td>
</tr>
</table>
// SNIPPET:
$.get('http://www.geoplugin.net/json.gp', function(result){
var geoplugin = JSON.parse(result.replace(/^[^\\{]+/, '').replace(/\\);?$/, ''));
console.log(geoplugin.geoplugin_countryCode);
});
// SNIPPET:
<input type=\"text\">
// SNIPPET:
<input type=\"file\">
// SNIPPET:
<table id=\"MyTable\">
<tr name=\"tr3\" id=\"tr3\">
<td>
<input type=\"text\" name=\"dt[]\" id=\"dt1\">
</td>
<td>
<input type=\"file\" name=\"fff[]\" id=\"ff1\">
</td>
</tr>
</table>
<input type=\"button\" name=\"sub1\" id=\"sub1\" value=\"Submit\" onclick=\"checkform();\">
// SNIPPET:
function checkform()
{
if(document.updateprojectdocs.dt[0].value=='')
{
alert(\"Fields marked with an asterisk are required.\");
document.updateprojectdocs.dt[0].focus();
return;
}
document.getElementById(\"TheForm\").submit();
}
// SNIPPET:
dt[]
// SNIPPET:
thecodeparadox
// SNIPPET:
ul
// SNIPPET:
<ul id=\"one\">
<li>blah</li>
<li>blah2</li>
</ul>
<ul id=\"two\">
<li>blah</li>
<li>blah2</li>
</ul>
// SNIPPET:
ul
// SNIPPET:
<a href=\"#\" id=\"mybutton\">My button</a>
// SNIPPET:
$('#mybutton').click(function() {
// check which ul is currently shown
// change z-index, so that the next ul is to be shown
});
// SNIPPET:
ul
// SNIPPET:
ul
// SNIPPET:
ul
// SNIPPET:
ul
// SNIPPET:
ul
// SNIPPET:
var obj={};
obj.plugin={
create: function(pluginname){
var default_value='p1';
var f1 = function(){
alert(default_value);
//define plugin properties
}
obj[pluginname] = function(){return new f1();}
/*
run other code here
*/
return {
//
f2: function(args){
default_value=args;
}
}
}
};
obj.plugin.create('pluginA').f2('pa');
obj.plugin.create('pluginB').f2('pb');
obj.pluginA(); // pa
obj.pluginB(); // pb
// SNIPPET:
obj.pluginA(); // pb
obj.pluginB(); // pb
// SNIPPET:
<div id=\"some_element_id\"></div>
url example: www.some_website.com/some_page#some_element_id
// SNIPPET:
$('#some_element_id').link_event().fadeOut(500).fadeIn(500)
// SNIPPET:
<script type=\"text/javascript\">
function CheckClicked() {
form1.HiddenField2.Value = span1.innerHTML;
alert(form1.HiddenField2.Value);
}
</script>
// SNIPPET:
<asp:Button id=\"cmd_Edit\" CssClass=\"button rnd-sml\" runat=\"server\" text=\"edit\" OnClick=\"cmd_Edit_Click\" Visible=\"False\" onclientclick=\"CheckClicked()\" />
// SNIPPET:
if (HiddenField2.Value!=\"True\")
{
FillData();
}
// SNIPPET:
var div = $(\"#\"+referencedPostNumber).clone(true,true).attr(\"id\",\"inlineQuote\"+referencedPostNumber)
$(div).css(\"border\",\"1px solid grey\");
$(div).css(\"display\",\"table\");
$(reference).after(div);
// SNIPPET:
$.get(reference.href, function(data) {
var div = $($(data).find('#' + referencedPostNumber)).clone(true,true).attr(\"id\",\"inlineQuote\"+referencedPostNumber)
$(div).css(\"border\",\"1px solid grey\");
$(div).css(\"display\",\"table\");
$(reference).after(div);
});
// SNIPPET:
var a= function(){
console.log('abc')
}
// SNIPPET:
var a= (function(){
console.log('abc')
})
// SNIPPET:
<script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js\"></script>
<link href=\"../../Scripts/plugins/ui.multiselect.css\" rel=\"stylesheet\" type=\"text/css\" />
<script src=\"../../Scripts/jquery-ui-1.8.23.min.js\" type=\"text/javascript\"></script>
<script src=\"../../Scripts/plugins/ui.multiselect.js\" type=\"text/javascript\"></script>
<script src=\"../../Scripts/js/jquery.jqGrid.min.js\" type=\"text/javascript\"></script>
<script src=\"../../Scripts/src/i18n/grid.locale-nl.js\" type=\"text/javascript\"></script>
<link href=\"../../Scripts/css/ui.jqgrid.css\" rel=\"stylesheet\" type=\"text/css\" />
<link href=\"../../Content/Site.css\" rel=\"stylesheet\" type=\"text/css\" />
<link href=\"../../Content/themes/base/jquery-ui.css\" rel=\"stylesheet\" type=\"text/css\" />
<table id=\"list\"></table>
<div id=\"pager\"></div>
<script type=\"text/javascript\">
jQuery(document).ready(function () {
jQuery(\"#list\").jqGrid({
url: '/Home/GridData/',
datatype: 'json',
mtype: 'GET',
autowidth: true,
colNames: ['Budgetsleutel', 'Beleidsdomein', 'beleidsitem'],
colModel: [
{ name: 'budetsleutel', index: 'budetsleutel', width: 40, align: 'left', sortable: true, resizable: true, search: true },
{ name: 'beleiddsdomein', index: 'beleidsdomein', width: 40, align: 'left', sortable: true, resizable: true, search: true },
{ name: 'beleidsitem', index: 'beleidsitem', width: 200, align: 'left', sortable: true, resizable: true, search: true}],
pager: '#pager',
pgbuttons: true,
rowNum: 10,
rowList: [],
sortname: 'Id',
sortorder: \"desc\",
gridview: true,
viewrecords: true,
height: 100,
caption: \"Toolbar Searching\"
});
jQuery(\"#list\").jqGrid('navGrid', '#pager');
jQuery(\"#list\").jqGrid('navButtonAdd', '#pager', {
caption: \"Columns\",
buttonicon: \"ui-icon-calculator\",
title: \"choose columns\",
jqModel:true,
onClickButton: function () {
jQuery(\"#list\").jqGrid('columnChooser');
}
});
});
// SNIPPET:
$metadata = '{\"hello\":\"world\", \"Test\":[\"hello\"]}';
$data = json_encode($metadata);
return $this->render('AcmeQuotesBundle:Home:metadata.html.twig', array('data' => $data));
// SNIPPET:
<script>
var obj = {{ data }}
document.body.innerHTML = \"\";
document.body.appendChild(document.createTextNode(JSON.stringify(obj, null, 4)));
</script>
// SNIPPET:
<script>
function createMarker(lat,lng)
{
alert(\"lat,lang\");
var marker = new google.maps.Marker({
map: map,
position: latlng,
content:content
});
if(icon){marker.setIcon(icon);}
if(center)
{
map.setCenter(latlng);
}
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(this.content);
infowindow.open(map, this);
});
if(action)
{
action.fnc(map,action.args);
}
return marker;
}
</script>
<body>
<div id=\"container\">
<div id=\"menu\" style=\"background-color:#FFD700;height:800px;width:100px;float:left;\">
<table border=\"0\">
<tr>
<th>Cities</th>
</tr>
<tr>
<td onclick=\"createMarker('40.47','73.58');\">newyork</td>
</tr>
<tr>
<td onclick=\"createMarker('41.50','87.83');\">chicago</td>
</tr>
</table>
</div>
<script type=\"text/javascript\">
var map;
var markersArray = [];
function initialize()
{
var latlng = new google.maps.LatLng(12.9833, 77.5833);
var myOptions = {
zoom: 10,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions);
// add a click event handler to the map object
google.maps.event.addListener(map, \"click\", function(event)
{
// place a marker
placeMarker(event.latLng);
});
}
// SNIPPET:
function Factory(){
// This holds which files have already been loaded
var loaded=new Object();
// Returns a new object
this.getObject=function(className,methodName,methodData){
if(loadFile('class.'+className+'.js')){
// Making sure that the object name is defined
if(window[className]!=null){
// Has to be an object
if(typeof(window[className])=='function'){
// Creating a temporary object
return new window[className];
}
}
}
}
// Loads a file over AJAX
var loadFile=function(address){
// Loads as long as the file has not already been loaded
if(loaded[address]==null){
// Required for AJAX connections (without ASYNC)
var XMLHttp=new XMLHttpRequest();
XMLHttp.open('GET',address,false);
XMLHttp.send(null);
// Result based on response status
if(XMLHttp.status===200 || XMLHttp.status===304){
// Getting the contents of the script
var data=XMLHttp.responseText;
// Loading the script contents to the browser
(window.execScript || function(data){
window['eval'].call(window,data);
})(data);
// makes sure that file is loaded only once
loaded[address]=true;
}
}
}
// SNIPPET:
var Factory=new Factory();
var alpha=Factory.getObject('example');
alpha.set(32);
alpha.get();
var beta=Factory.getObject('example');
beta.set(64);
alpha.get();
beta.get();
// SNIPPET:
return new window[className];
// SNIPPET:
className
// SNIPPET:
window[]
// SNIPPET:
'example'
// SNIPPET:
'test_example'
// SNIPPET:
... if(window['test_'+className]!=null){ ...
... if(typeof(window['test_'+className])=='function'){ ...
... return new window['test_'+className]; ...
// SNIPPET:
className+''
// SNIPPET:
function example(){
var myVar=16;
this.set=function(value){
myVar=value;
}
this.get=function(){
alert(myVar);
}
}
// SNIPPET:
onclick='return confirm (\"Do you really want to go out of the page ?\")'
// SNIPPET:
const self = require(\"self\"),
page_mod = require(\"page-mod\");
exports.main = function() {
page_mod.PageMod({
include: \"*myexample.com*\",
contentScriptWhen: \"ready\",
contentScriptFile: self.data.url(\"inject.js\")
});
};
// SNIPPET:
include: \"*.myexample.com/*\",
include: \"*.myexample.com*\",
// SNIPPET:
<input id=\"txt1\" type=\"text\" /> </br>
<input id=\"txt2\" type=\"text\" /> </br>
<input id=\"txt3\" type=\"text\" /> </br>
// SNIPPET:
$('input[type=text]').keyboard({
layout: \"num\"
});
$('.ui-keyboard').on('click', 'input[name=\"key_accept\"]',function() {
alert('Accept button was clicked in text1');
// do your stuff here
});
// SNIPPET:
for(initialize1,initialize2; condition1,condition2; incrementation1,incrementation2)
// SNIPPET:
%PDF-1.4....
.....
....hole data representing the file
....
%% EOF
// SNIPPET:
// responseText encoding
pdfText=$.base64.decode($.trim(pdfText));
// Now pdfText contains %PDF-1.4 ...... data...... %%EOF
var winlogicalname = \"detailPDF\";
var winparams = 'dependent=yes,locationbar=no,scrollbars=yes,menubar=yes,'+
'resizable,screenX=50,screenY=50,width=850,height=1050';
var htmlText = '<embed width=100% height=100%'
+ ' type=\"application/pdf\"'
+ ' src=\"data:application/pdf,'
+ escape(pdfText)
+ '\"></embed>';
// Open PDF in new browser window
var detailWindow = window.open (\"\", winlogicalname, winparams);
detailWindow.document.write (htmlText);
detailWindow.document.close ();
// SNIPPET:
function getNewsFeed(d) {
var c = {
page_num: b,
num_events: d,
return_as_html: true,
source: \"web\"
};
TAGGED.api.call(c, check)
}
// SNIPPET:
function check() {
// checking here
}
// SNIPPET:
var ray = new THREE.Ray( platform.position, ball.position.subSelf( platform.position ).normalize() );
var intersects = ray.intersectObject( ball );
if ( intersects.length > 0 ) console.log(intersects[0].distance);
// SNIPPET:
subSelf
// SNIPPET:
normalize()
// SNIPPET:
Array
// SNIPPET:
[int, String]
// SNIPPET:
[1, \"Foo\"]
// SNIPPET:
[9, \"Bar\"]
// SNIPPET:
[:any, \"Some key\"]
// SNIPPET:
IDBKeyRange
// SNIPPET:
<head>
// SNIPPET:
<style> div#target{ display:none } <style>
<script> $(document).ready(function(){ $('div#target').show(); }); </script>
// SNIPPET:
<body>
// SNIPPET:
<style> div#target{ display:none } <style>
<div id=\"target\">stuff in div</div>
<script> $('div#target').show(); </script>
// SNIPPET:
<h3 value=\"1\" id=\"header1\" class=\"ui-accordion-header ui-helper-reset
ui-state-default ui-corner-all\"
role=\"tab\" aria-expanded=\"true\" aria-selected=\"true\" tabindex=\"0\">
<div id=\"text1\">ACCORDION N1</div>
</h3>
<div id=\"content1\">content of accordion n1</div>
<h3 value=\"2\" id=\"header2\" class=\"ui-accordion-header ui-helper-reset
ui-state-default ui-corner-all\"
role=\"tab\" aria-expanded=\"true\" aria-selected=\"true\" tabindex=\"0\">
<div id=\"text2\">ACCORDION N2</div>
</h3>
<div id=\"content2\">content of accordion n2</div>
<h3 value=\"3\" id=\"header3\" class=\"ui-accordion-header ui-helper-reset
ui-state-default ui-corner-all\"
role=\"tab\" aria-expanded=\"true\" aria-selected=\"true\" tabindex=\"0\">
<span class=\"ui-icon ui-icon-triangle-3-e\"></span>
<div id=\"text3\">ACCORDION N3</div>
</h3>
<div id=\"content3\">content of accordion n3</div>​
// SNIPPET:
$('.clickAccordion').click(function(){
var tmpAccordionClicked = $(this);
var tmpIndex = tmpAccordionClicked.attr('value');
var tmpContent = $(\"#content\"+tmpIndex);
if((\"#header\"+tmpIndex).hasClass('ui-state-active')){
$(\"#text\"+tmpIndex).html(\"ACCORDION N.\"+tmpIndex);
}
if((\"#header\"+tmpIndex).hasClass('ui-state-default')){
$(\"#text\"+tmpIndex).html(tmpContent);
}
});
// SNIPPET:
.discover_wrapper.handpick table.autocomplete {
margin-left: -61.8%;
margin-top: 55px;
width: 468px !important;
}
// SNIPPET:
inSearch: (e) ->
target = @$(e.currentTarget)
unless @autocompleteActivated
@autocompleteActivated = true
target.autocomplete
appendNode: target.parent()
customizedHeight: 65
params:
limit: 15 # this is to set to maximum
serviceUrl: \"/sm/search\"
types: [\"users\"]
showTitle: false
addQuestion: false
fnFormatter: (type, obj) ->
return obj.term
onSelect: (type, data, obj) =>
switch type
when \"users\"
data_array = data.term.split(' ')
target.focus().select()
target.val data_array[data_array.length-1]
@$('.signup').show()
#event to trigger the autocomplete table (input.name is the input box)
events:
\"focus input.name\" : \"inSearch\"
// SNIPPET:
var a1 = new Array();
for (var i = -100; i<=100; i++)
a1[i] = i;
for (var i in a1)
{
document.write(i + \"=\" + a1[i])
document.write(\"<br>\");
}
document.write(a1.length);
// SNIPPET:
<table>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
...
</table>
// SNIPPET:
<div=container>
<div>...</div>
<div>...</div>
<div>...</div>
<div>...</div>
<div>...</div>
...
</div>
// SNIPPET:
table
// SNIPPET:
container
// SNIPPET:
function breadcrumb(attr) {
hash = { type: \"POST\", url: \"brands/get_attributes\", data: $(\"#attributeform\").serialize() };
$.ajax(hash);
return false;
}
// SNIPPET:
<a href=\"javascript:breadcrumb(\\'<%= brand_attribute.attributename %>\\');\"><%= value %></a>
// SNIPPET:
javascript:breadcrumb('Whirlpool');
// SNIPPET:
ws.send('my_message_to_server');
// SNIPPET:
ws.bind('message', function(message) {
console.log(message);
});
// SNIPPET:
function request(message){
ws.send(message);
//How wait for receive???
return response;
}
// SNIPPET:
series: [{
name: 'Tokyo',
data: [7.0, 6.9, 9.5, 14.5, 18.2],
name: 'LA',
data: [7.0, 6.9, 9.5, 14.5, 18.2]
}]
// SNIPPET:
success: function (result) {
var resultobj = jQuery.parseJSON(result);
for (i = 0; i < resultobj.length; i++) {
var objt = resultobj[i];
// what TODO?????
highchartresultarray.push(objt.name);
}
// SNIPPET:
<ul>
<li>
Some txt1
<input type=\"hidden\" name=\"li1\" value=\"1\"/>
</li>
<li>
Some txt2
<input type=\"hidden\" name=\"li2\" value=\"2\"/>
</li>
</ul>
// SNIPPET:
<li>
// SNIPPET:
@RequestMapping(value = \"/listItems\")
public @ResponseBody GridModel getUsersForGrid(@RequestParam(value = \"items\") List<NameIdPair> items){...}
// SNIPPET:
unrecognized expression: input:checked[name=match_list[]]
// SNIPPET:
<label class=\"checkbox\">
<input type=\"checkbox\" name=\"match_list[]\" value=\"10\">
Item 10
</label>
<label class=\"checkbox\">
<input type=\"checkbox\" name=\"match_list[]\" value=\"20\">
Item 20
</label>
// SNIPPET:
var arr=[];
$('input:checked[name=match_list[]]').each(function(){
arr.push($(this).val());
});
// SNIPPET:
{\"prev\":[\"\",\"demo\\/medium\\/Web081112_P001_medium.jpg\"],\"curr\":[\"demo\\/medium\\/Web081112_P002_medium.jpg\",\"demo\\/medium\\/Web081112_P003_medium.jpg\"],\"next\":[\"demo\\/medium\\/Web081112_P004_medium.jpg\",\"demo\\/medium\\/Web081112_P005_medium.jpg\"]}
// SNIPPET:
prev img1, img2
curr img1, img2
next img1, img2
// SNIPPET:
<img src =\".....\"> and I would like define each of it to <img id= \"prevIMG2\" src =\"\">
And assign the prev img2 to that <img id= \"prevIMG2\" src =\"demo/medium/Web081112_P001_medium.jpg\">
// SNIPPET:
<img src=\"\">
// SNIPPET:
$(document).ready(function(){
$.ajax({
type: \"GET\",
url: \"scandir.php\",
data: \"page=5\",
dataType: 'json',
success: function (data) {
$.each(data, function(index, element) {
if($.trim(this[0]) !== '')
$('#prevL').attr('src',data);
});
}
});
});
// SNIPPET:
$(\"#my-datatable\").dataTable( {
\"bProcessing\" : true,
\"bPaginate\": false,
\"bLengthChange\": false,
\"bFilter\": true,
\"bSort\": false,
\"bInfo\": false,
\"bAutoWidth\": false,
\"sAjaxSource\" : \"/myServer/getAllWidgets\",
\"sAjaxDataProp\" : \"\",
\"bDestroy\" : true,
\"fnServerData\" : function(sSource, aoData, fnCallback) {
aoData.push({
\"name\" : \"widgetName\",
\"value\" : wName
});
request = $.ajax({
\"dataType\" : \"json\",
\"type\" : \"GET\",
\"url\" : sSource,
\"data\" : aoData,
\"success\" : fnCallback
});
},
\"aoColumns\" : [
{
\"mDataProp\" : \"widgetType\"
},
{
\"mDataProp\" : \"widgetValue\"
},
{
\"mDataProp\" : \"widgetFactor\"
}
]
});
// SNIPPET:
/myServer/getAllWidgets
// SNIPPET:
widgets
// SNIPPET:
/myServer/getAllWidgets
// SNIPPET:
fnReloadAjax
// SNIPPET:
<div id=\"refresh-button-div\">
<input type=\"button\" id=\"refreshButton\" onclick=\"refreshData\"/>
</div>
// In JS
$(\"#refreshButton\").click(function() {
// ???
});
// SNIPPET:
var db = window.openDatabase(\"Database\", \"1.0\", \"Cordova Demo\", 200000);
// SNIPPET:
window.open()
// SNIPPET:
$(document).ready(function()
{
function invoice()
{
var wind = window.open('','_blank','width=700,height=700,scrollbars=yes,status=yes');
var html = '<input type=\"button\" id=\"submit_button\" value=\"Submit\"/>';
$(wind.document.body).html(html);
}
$('#print_invoice').click(invoice);
});
// SNIPPET:
id=\"submit_button\"
// SNIPPET:
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || \"An unknown browser\";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| \"an unknown version\";
this.OS = this.searchString(this.dataOS) || \"an unknown OS\";
},
searchString: function (data) {
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
},
dataBrowser: [
{
string: navigator.userAgent,
subString: \"Chrome\",
identity: \"Chrome\"
},
{ string: navigator.userAgent,
subString: \"OmniWeb\",
versionSearch: \"OmniWeb/\",
identity: \"OmniWeb\"
},
{
string: navigator.vendor,
subString: \"Apple\",
identity: \"Safari\",
versionSearch: \"Version\"
},
{
prop: window.opera,
identity: \"Opera\"
},
{
string: navigator.vendor,
subString: \"iCab\",
identity: \"iCab\"
},
{
string: navigator.vendor,
subString: \"KDE\",
identity: \"Konqueror\"
},
{
string: navigator.userAgent,
subString: \"Firefox\",
identity: \"Firefox\"
},
{
string: navigator.vendor,
subString: \"Camino\",
identity: \"Camino\"
},
{ // for newer Netscapes (6+)
string: navigator.userAgent,
subString: \"Netscape\",
identity: \"Netscape\"
},
{
string: navigator.userAgent,
subString: \"MSIE\",
identity: \"Explorer\",
versionSearch: \"MSIE\"
},
{
string: navigator.userAgent,
subString: \"Gecko\",
identity: \"Mozilla\",
versionSearch: \"rv\"
},
{ // for older Netscapes (4-)
string: navigator.userAgent,
subString: \"Mozilla\",
identity: \"Netscape\",
versionSearch: \"Mozilla\"
}
],
dataOS: [
{
string: navigator.platform,
subString: \"Win\",
identity: \"Windows\"
},
{
string: navigator.platform,
subString: \"Mac\",
identity: \"Mac\"
},
{
string: navigator.userAgent,
subString: \"iPhone\",
identity: \"iPhone/iPod\"
},
{
string: navigator.platform,
subString: \"Linux\",
identity: \"Linux\"
}
]
};
BrowserDetect.init();
var x = (BrowserDetect.browser);
var y = (BrowserDetect.version);
var z = (BrowserDetect.OS);
// SNIPPET:
<input type='text' value=\"2012-12-30 Morning\">
<input type='text' value=\"2012-12-30 Lunch\">
<input type='text' value=\"2012-12-30 Dinner\">
<input type='text' value=\"2012-12-30 Either akgalkgalkgla\">
<input type='text' value=\"2012-12-30\">
<input type='text' value=\"Morning\">
<button>Check</button>
// SNIPPET:
$(\"button\").click(function() {
$(\"input\")
.filter(function() {
return this.value.match(/[0-9]{4}-[0-9]{2}-[0-9]{2}\\s[A-Za-z]+/);
})
.css(\"border\", '1px solid red');
})​
// SNIPPET:
^
// SNIPPET:
$
// SNIPPET:
[0-9]{4}-[0-9]{2}-[0-9]{2}\\s[A-Za-z]+
// SNIPPET:
2012-12-30 Morning
2012-12-30 Lunch
2012-12-30 Dinner
2012-12-30 Either akgalkgalkgla
// SNIPPET:
^[0-9]{4}-[0-9]{2}-[0-9]{2}\\s[A-Za-z]+$
// SNIPPET:
<form method=\"post\" onsubmit=\"return validateForm();\">
{% csrf_token %}
<div id='error_message'></div>
<input class='username' type=\"text\" name=\"username\" value=\"\"/>
<button type=\"submit\">Valider</button>
</form>
// SNIPPET:
def myview(request):
users = User.objects.all()
return render_to_response('mytemplate.html', 'users':users, context_instance=RequestContext(request))
// SNIPPET:
<div class='search'>
{% for user in users %}
<input type='hidden' value='{{user.username}}'
{% endfor %}
</div>
// SNIPPET:
function validateForm() {
var value = $('.username').val()
if( // find 'value' in all the <input type='hidden'> ) {
var error = 'Username already exists';
$(\"#error_message\").html(error);
return false;
}
};
// SNIPPET:
(function($) {
$(function() {
$(\"#scroller\").simplyScroll({
auto: false,
speed: 50
});
});
})(jQuery);
// SNIPPET:
function RefreshScroll() {
MyScroll.scrollToElement('li:nth-child(1)', 100)// Jump to the first element
setTimeout(function () {
MyScroll.refresh();// Refresh scroll bar -function of iscroll 4
}, 0);
}
// SNIPPET:
document.addEventListener('DOMContentLoaded', LoadScroll, false);
var myScroll;
function LoadScroll() {
document.addEventListener('touchmove', function (e) { e.preventDefault(); });
myScroll= new iScroll('wrapper');
}
// SNIPPET:
<div class=\"containerDiv\">
<div class=\"rowDivHeader\">
<div class=\"cellDivHeader\">Recommendation</div>
<div class=\"cellDivHeader\">Typical savings</div>
<div class=\"cellDivHeader\">Improved SAP</div>
<div class=\"cellDivHeader\">Improved EI</div>
<div class=\"cellDivHeader\">Indicative cost</div>
<div class=\"cellDivHeader\">Include</div>
<div class=\"cellDivHeader lastCell\">Removal Reason</div>
</div>
<div class=\"rowDiv\">
<div class=\"cellDiv\">Room-in-roof-insulation</div>
<div class=\"cellDiv\">93.0</div>
<div class=\"cellDiv\">F : 29</div>
<div class=\"cellDiv\">B : 89</div>
<div class=\"cellDiv\">£1,500 - £2,700</div>
<div class=\"cellDiv\">
<input type=\"checkbox\" class=\"checkbox\"/>
</div>
<div class=\"cellDiv lastCell\">
<input type=\"text\" class=\"textbox\"/>
</div>
</div>
<div class=\"rowDiv\">
<div class=\"cellDiv\">Room-in-roof-insulation</div>
<div class=\"cellDiv\">93.0</div>
<div class=\"cellDiv\">F : 29</div>
<div class=\"cellDiv\">B : 89</div>
<div class=\"cellDiv\">£1,500 - £2,700</div>
<div class=\"cellDiv\">
<input type=\"checkbox\" class=\"checkbox\"/>
</div>
<div class=\"cellDiv lastCell\">
<input type=\"text\" class=\"textbox\"/>
</div>
</div>
<div class=\"rowDiv\">
<div class=\"cellDiv\">Room-in-roof-insulation</div>
<div class=\"cellDiv\">93.0</div>
<div class=\"cellDiv\">F : 29</div>
<div class=\"cellDiv\">B : 89</div>
<div class=\"cellDiv\">£1,500 - £2,700</div>
<div class=\"cellDiv\">
<input type=\"checkbox\" class=\"checkbox\"/>
</div>
<div class=\"cellDiv lastCell\">
<input type=\"text\" class=\"textbox\"/>
</div>
</div>
</div>
// SNIPPET:
<select onchange=\"redirect(this.value)\">
<option>choose a category</option>
<option>Business</option>
<option>Music</option>
<option>Sports</option>
<option>Cause</option>
<option>Politics</option>
</select>
// SNIPPET:
<script>
function redirect(ddcategory){
window.location= ddcategory;
}
</script>
// SNIPPET:
users: {
friends: [{name: String, id: String}]
}
// SNIPPET:
var names = [String]
var ids = [String]
// SNIPPET:
textarea
// SNIPPET:
function duplicateCheck() {
var output = document.getElementById('Output');
output.innerHTML = '';
var duplicateSerials = [];
var count = 0;
var textArea = document.getElementById('Serials');
var serials = textArea.value.trim().split(/ *\\n */);
for(var i = 0;i < serials.length;i++){
var serial = serials[i];
if(serials.indexOf(serial) != serials.lastIndexOf(serial) &&
duplicateSerials.indexOf(serial) == -1 && serial !== '') {
duplicateSerials.push(serial);
}
}
// For testing
output.innerHTML = '<pre>Serials:\\t' + serials.toString() + \"<br />\" +
'Duplicates:\\t' + duplicateSerials.toString() + \"<br>\" +
'</pre>';
}
// SNIPPET:
var change = [['Z', null, 'X']]
// SNIPPET:
$.ajax({
url: \"/incomes\",
dataType: \"text\",
type: \"POST\",
data: { data: change },
});
// SNIPPET:
change[0][0] Z
change[0][1]
change[0][2] X
// SNIPPET:
Internal Server Error
// SNIPPET:
expected Hash (got Array) for param 0
// SNIPPET:
ERROR TypeError: expected Hash (got Array) for param `0'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/utils.rb:127:in `normalize_params'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/utils.rb:128:in `normalize_params'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/utils.rb:96:in `block in parse_nested_query'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/utils.rb:93:in `each'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/utils.rb:93:in `parse_nested_query'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/request.rb:332:in `parse_query'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/request.rb:209:in `POST'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/methodoverride.rb:26:in `method_override'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/methodoverride.rb:14:in `call'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/runtime.rb:17:in `call'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/lock.rb:15:in `call'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.9/lib/action_dispatch/middleware/static.rb:62:in `call'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/engine.rb:479:in `call'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application.rb:223:in `call'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/content_length.rb:14:in `call'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/rack/log_tailer.rb:17:in `call'
/home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/handler/webrick.rb:59:in `service'
/home/g/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/home/g/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/home/g/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
// SNIPPET:
file: 'http://www.example.com/media/trailer.flv',
// SNIPPET:
primary: 'flash',
fallback: 'false',
// SNIPPET:
ul
// SNIPPET:
display: block;
position: fixed;
left: 0;
top: 0;
overflow: hidden;
z-index: -999;
height: 100%;
width: 100%;
// SNIPPET:
<form action=\"mailto:you@yourdmainhere.com\" method=\"post\" enctype=\"text/plain\" >
FirstName:<input type=\"text\" name=\"FirstName\">
Email:<input type=\"text\" name=\"Email\">
<input type=\"submit\" name=\"submit\" value=\"Submit\">
</form>
// SNIPPET:
<style>
#secondopt, #firstopt { display: none;}
</style>
<script>
function checkme(){
if (document.getElementById(\"opt1\").checked == true){
document.getElementById(\"firstopt\").style.display = \"block\"
document.getElementById(\"secondopt\").style.display = \"none\";
}
if (document.getElementById(\"opt2\").checked == true){
document.getElementById(\"firstopt\").style.display = \"none\"
document.getElementById(\"secondopt\").style.display = \"block\";
}
}
</script>
<form name=\"form1\">
<label><input type=\"radio\" name=\"opt\" id=\"opt1\" onclick=\"checkme()\" /> First opt</label>
<label><input type=\"radio\" name=\"opt\" id=\"opt2\" onclick=\"checkme()\" /> Second Opt</label>
<div id=\"firstopt\">
<label><input type=\"radio\" name=\"items\" value=\"data1\" />Item 1</label>
<label><input type=\"radio\" name=\"items\" value=\"data2\" />Item 2</label>
<label><input type=\"radio\" name=\"items\" value=\"data3\" />Item 3</label>
<label><input type=\"radio\" name=\"items\" value=\"data4\"/>Item 4</label>
<label><input type=\"radio\" name=\"items\" value=\"data5\"/>Item 5</label>
</div>
<div id=\"secondopt\">
<label><input type=\"radio\" name=\"items\" value=\"data6\"/>Item 6</label>
<label><input type=\"radio\" name=\"items\" value=\"data7\"/>Item 7</label>
<label><input type=\"radio\" name=\"items\" value=\"data8\"/>Item 8</label>
<label><input type=\"radio\" name=\"items\" value=\"data9\"/>Item 9</label>
<label><input type=\"radio\" name=\"items\" value=\"data10\"/>Item 10</label>
</div>
</form>
// SNIPPET:
home.js
// SNIPPET:
(function () {
\"use strict\";
WinJS.UI.Pages.define(\"/pages/home/home.html\", {
// This function is called whenever a user navigates to this page. It
// populates the page elements with the app's data.
ready: function (element, options) {
var submit = document.getElementById(\"submitBtn\");
submit.addEventListener(\"click\", myFunc());
}
});
function myFunc() {
// Do some stuff here
}
})();
// SNIPPET:
myFunc()
// SNIPPET:
requirejs.onError = function (err) {
// this works:
var script_that_failed_loading = err.originalError.target.src
// now I want:
var the_script_responsible_for_this = <???>
};
// SNIPPET:
.sortElements(function(a, b){
return $.text([a]) > $.text([b]) ?
inverse ? -1 : 1
: inverse ? 1 : -1;
}
// SNIPPET:
in
// SNIPPET:
.categories ul.sub {
position: absolute;
right: -191px;
top: 0;
background: #fff;
width: 190px;}
// SNIPPET:
<div class=\"categories\">
<ul class=\"maincats\">
<li>
<a class=\"first\"><img/><span>Category Name</span></a>
<ul class=\"sub first\">
<li><h2>H2 Title</h2></li>
<li>Title</li>
<li>Title</li>
<li>Title</li>
<li>Title</li>
</ul>
</li>
</ul></div>
// SNIPPET:
$(\".categories li a\").hover(
function () {
$(this).addClass(\"hover\");
$(this).next('ul.sub').show();
},
function () {
$(this).removeClass(\"hover\");
$(this).next('ul.sub').hide();
}
);
$(\".categories ul.sub\").hover(
function () {
$(this).prev().addClass(\"hover\");
$(this).show();
},
function () {
$(this).prev().removeClass(\"hover\");
$(this).hide();
}
);
$(function () {
var zIndexNumber = 10;
// Put your target element(s) in the selector below!
$(\".categories ul.sub\").each(function () {
$(this).css('zIndex', zIndexNumber);
});
});
// SNIPPET:
<script src=\"/media/system/js/mootools-core.js\" type=\"text/javascript\"></script>
<script src=\"/media/system/js/core.js\" type=\"text/javascript\"></script>
<script src=\"/media/system/js/mootools-more.js\" type=\"text/javascript\"></script>
<script src=\"/media/kunena/js/mediaboxAdv-min.js\" type=\"text/javascript\"></script>
<script src=\"/media/kunena/js/default-min.js\" type=\"text/javascript\"></script>
<script src=\"/templates/beez_20/javascript/md_stylechanger.js\" type=\"text/javascript\" defer=\"defer\"></script>
<script type=\"text/javascript\">
function noError(){return true;}
window.onerror = noError;
// <![CDATA[
var kunena_toggler_close = \"Collapse\";
var kunena_toggler_open = \"Expand\";
// ]]>
// <![CDATA[
var kunena_anonymous_name = \"Anonymous\";
// ]]>
</script>
// SNIPPET:
$(window).scroll(function(evt) {
if($(window).scrollTop() + $(window).height() > ($(document).height() - 100))
{
document.getElementById('mainForm:hiddenRegButton').click();
}
});
// SNIPPET:
(function () {
function f(i) {
if (i.origin !== e + \"\" + n) {
return
}
if (i.data === \"destroy_bookmarklet\") {
var s = document.getElementById(g);
if (s) {
document.body.removeChild(s);
s = null
}
}
}
var e = \"http://\",
n = \"URL GOES HERE\",
g = \"ID_div\",
r = \"ID_content_iframe\",
i = document.getElementById(r);
if (i) {
return
}
var d = document.createElement(\"div\"),
s = e + \"\" + n + \"/post/create?response_type=embed\",
o = document.createElement(\"iframe\");
d.id = g;
d.style.position = \"absolute\";
d.style.top = \"0\";
d.style.left = \"0\";
d.style.height = \"100%\";
d.style.width = \"100%\";
d.style.zIndex = \"16777270\";
o.id = r;
o.src = s + \"&link=\" + encodeURIComponent(window.location.href) + \"&title=\" + encodeURIComponent(document.title) + \"&description=\" + encodeURIComponent(\"\" + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text));
o.style.height = \"600px\";
o.style.width = \"650px\";
o.style.border = \"10px solid #333333\";
o.style.marginTop = \"100px\";
o.style.marginLeft = \"auto\";
o.style.marginRight = \"auto\";
o.style.display = \"block\";
o.style.background = \"#ffffff\";
o.style.overflowY = 'scroll';
o.style.overflowX = 'hidden';
document.body.appendChild(d);
d.appendChild(o);
var u = window.addEventListener ? \"addEventListener\" : \"attachEvent\";
var a = u == \"attachEvent\" ? \"onmessage\" : \"message\";
window[u](a, f, false)
})();
// SNIPPET:
myDiv.scroll(function () {
$newh=$('#wrapper_sl').height()+$(this).scrollTop(); //eternal scroll
$('#wrapper_sl').height($newh); //eternal scroll
var $nower=(($(this).scrollTop()+$start_pr)/$skorost)+$ugol*8;
for (var ink=0, len = $kolvo; ink < len; ink++)
{
$rad=((ink)*$ugol+$nower);
$deg=$rad*360/(2*Math.PI)+270;
$(ImgDiv[ink]).offset({top: Math.cos(($rad))*$size_dug+$smes_y, left: Math.sin(-($rad))*($size_dug)+$smes_x }).css({'transform':'skewX(-'+$deg+'deg) rotateX('+$deg+'deg)'});
};
});
// SNIPPET:
Ext.define('MyApp.view.Home', {
extend : 'Ext.tab.Panel',
id : 'home',
xtype : 'homeview',
requires : ['Ext.TitleBar', 'Ext.Video', 'MyApp.view.Profile'],
initialize : function() {
console.log('Initializing Home');
var me = this
var config = me.getInitialConfig();
var username = config.username;
var items = [];
items.push({
xtype : 'titlebar',
docked : 'top',
title : 'Hello ' + username
}, {
xtype : 'updatesview',
}, {
xtype : 'searchview',
}, {
xtype : 'profileview'
}, {
xtype : 'messagesview'
}, {
xtype : 'sensesview'
});
me.setItems(items);
console.log('Initializing Home');
},
config : {
title : 'Home',
iconCls : 'home',
tabBarPosition : 'bottom'
}
});
// SNIPPET:
Ext.define('MyApp.view.Home', {
extend : 'Ext.tab.Panel',
id : 'home',
xtype : 'homeview',
requires : ['Ext.TitleBar', 'Ext.Video', 'MyApp.view.Profile'],
config : {
title : 'Home',
iconCls : 'home',
tabBarPosition : 'bottom',
items : [{
xtype : 'updatesview',
}, {
xtype : 'searchview',
}, {
xtype : 'profileview'
}, {
xtype : 'messagesview'
}, {
xtype : 'sensesview'
}]
}
});
// SNIPPET:
me.setItems(items);
me.addItems(items);
// SNIPPET:
initialize : function() {
console.log('init home');
},
// SNIPPET:
toArray('test'); // => [\"test\"]
toArray(['test']); // => [\"test\"]
// SNIPPET:
var toArray;
toArray = function(o) {
if (Array.isArray(o)) {
return o.slice();
} else {
return [o];
}
};
// SNIPPET:
Array('test') # => [\"test\"]
Array(['test']) # => [\"test\"]
// SNIPPET:
<script language=\"JavaScript\">
<!--
function simple_or_advanced_search(advanced_value)
{
if (advanced_value == \"advanced\")
{
jQuery('.advanced_search').show();
jQuery('.advanced_search_alternate').hide();
}
else
{
jQuery('.advanced_search').hide();
jQuery('.advanced_search_alternate').show();
}
document.bibletool.advancedSearch.value = advanced_value;
}
// -->
</script>
// SNIPPET:
define(['services/logger'], function (logger) {
var model = \"somedata\"
var vm = {
activate: activate,
title: 'Details View'
};
return vm;
function activate() {
logger.log('Details View Activated', null, 'details', true);
return true;
}
});
// SNIPPET:
define(['services/logger'], function (logger) {
var model = \"somedata\"
return {
activate: activate,
title: 'Details View'
};
function activate() {
logger.log('Details View Activated', null, 'details', true);
return true;
}
});
// SNIPPET:
var name = document.getElementById(\"name\");
// SNIPPET:
$(thumb).draggable({});
// SNIPPET:
$(\":range\").rangeinput();
// SNIPPET:
function counter() {
//Grabs the range and pinpoint cell
var ssRange = SpreadsheetApp.getActiveSheet().getRange(1,1,1,1);
//Grab the cell value of A1
var value = ssRange.getValue();
//if statement to check value in A1 and if it is null, undefined, false, 0, NAN
if (!value) {
//if the cell is null, undefined, false, 0, NAN sets value to 1
var setCell = ssRange.setValue(1);
}
//if not updates the cell by getting the value and adding 1 to it
else {
var updateCell = ssRange.setValue(value + 1);
}
}
// SNIPPET:
function counter2() {
//Get the spreadsheet, range, and value of first cell in range
var sSheet = SpreadsheetApp.getActiveSheet();
var ssRange = sSheet.getRange(1,1,1,1);
var ssValue = ssRange.getValue();
var setUniqueID = ScriptProperties.setProperty(\"MYID\",1);
var getUniqueID = ScriptProperties.getProperty(\"MYID\");
//will set value of first cell to 1 if null, undefined, false, 0, NAN etc.. (runs in if //statement)
var setOne = ssRange.setValue(getUniqueID);
if (!ssValue) {
setOne;
}
else {
//This goes back and get the range, lastrow of range, and value of first cell in range of last row & adds 1 to that value
var setLast = sSheet.getRange(lastRow+1,1,1,1).setValue(getUniqueID + 1);
setLast;
}
}
// SNIPPET:
TypeError: Arguments to path.join must be strings.
// SNIPPET:
<div class=\"bar\">One Two </div> //(hide it after few seconds and show next line)
<div class=\"bar\">Three Four </div> //(hide it after few seconds and show next line)
<div class=\"bar\">Five Six </div> //(hide it after few seconds and show next line)
<div class=\"bar\">Seven </div> //(hide it after few seconds)
// SNIPPET:
$('.bar').fadeIn(1000).text(displayWords).fadeOut(1000);
// SNIPPET:
for(var k=0;k<resultSet.length;k++)
{
alert(resultSet[k]);
$.get('/api/TagsApi/ElementsTagsIntersect?ids='+resultSet[k], function (data) {
testingarr = [];
for (var i = 0; i < data.length; i++) {
testingarr.push(data[i][\"ID\"]);
}
for (var w = 0; w <3; w++) {
if (($.inArray(testingarr[w], selectedloc)) > -1) {
var str = \"<input type='checkbox' name ='test[]' value='\" + resultSet[k] + \"'/>\" + resultSet[k] + \"</br>\";
$('#childs').append(str);
alert(resultSet[k]);
break;
}
}
}, 'json');
// SNIPPET:
//clear div
$('#putMap').empty();
//call to get new friend list
$('#putMap').load('getVisitMap.php?u=' + userID ,
function() {
alert(\"called load function\");
});
return false;
// SNIPPET:
$userID = $_GET['u'];
//Get all breweries
echo \"<div id=\\\"map_canvas\\\" style=\\\"width: 600px; height: 400px;\\\"></div>\";
echo '<script type=\"text/javascript\">
var locations = [';
//count unique breweries
***mysql call is here****
echo \"before for loop\";
for( $i = 0; $i < $breweryNum; $i++){
$row = $resultBrew ->fetch_assoc();
$brewery = $row['beerBrewery'];
$long = $row['longi'];
$lat = $row['lat'];
$breweryURL = \"breweryPage.php?id=$breweryID\";
echo \"['$brewery', $lat, $long] \";
//add camas if not last one
if($i != $breweryNum - 1 ){
echo ',';
}
}
echo '
];
var map = new google.maps.Map(document.getElementById(\\'map_canvas\\'), {
zoom: 10,
center: new google.maps.LatLng(-33.92, 151.25),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var bounds = new google.maps.LatLngBounds();
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
var position = new google.maps.LatLng(locations[i][1], locations[i][2]);
marker = new google.maps.Marker({
position: position,
map: map
});
google.maps.event.addListener(marker, \\'click\\', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
bounds.extend(position);
} //end for loop
map.fitBounds(bounds);
</script>
';
// SNIPPET:
<div id=\"map_canvas\" style=\"width: 600px; height: 400px;\"></div><script type=\"text/javascript\">
var locations = [
// SNIPPET:
$page->content .= \"<div id = \\\"putMap\\\">
<div id=\\\"map_canvas\\\" style=\\\"width: 600px; height: 400px;\\\"></div>\";
$map = createMap($userID);
$page->content .= \"
$map
</div>
\";
// SNIPPET:
<form class=\"signup\">
<div class=\"group\">
<div class=\"row\">
<label>Username</label>
<input type=\"text\">
</div>
<div class=\"row\">
<label>Password</label>
<input type=\"password\">
</div>
</div>
<input type=\"submit\" value=\"Sign In\">
</form>
// SNIPPET:
$('.signup').submit(function () {
if($(this).valid()) {
alert('Logged in');
}else {
alert('Error!');
}
});
// SNIPPET:
<form action=\"\" method=\"post\" id=\"contactForm\">
<input id='inputbox' name=\"inputbox\" type=\"text\" />
<button type=\"button\" id='search'> search </button>
</form>
// SNIPPET:
$(document).ready(function() {
$(\"#inputbox\").keyup(function(event){
if(event.keyCode == 13){
$(\"#search\").click();
}
});
$('#search').click(function(){
var inputbox= $(\"#inputbox\").val();
//stuff
});
});
// SNIPPET:
test.php
// SNIPPET:
$.post()
// SNIPPET:
getURL.php
// SNIPPET:
getURL.php
// SNIPPET:
$.post()
// SNIPPET:
function(data)
// SNIPPET:
$.post()
// SNIPPET:
function(data,status) I'm satisfied with the result of the returned value of the data parameter; the PROBLEM is that I can't assign it's value outside this function:
// SNIPPET:
<script src=\"jquery-1.9.1.js\">
</script>
<script type=\"text/javascript\">
var imgPath; // <--He is who should get the value of \"data\"
function getTargetUrl(szolg){
$.post(
\"getURL.php\",
{ x: szolg },
function(data,status){
alert(\"in function: \" + data + \" status: \" + status);
imgPath=data;
alert (imgPath);
}
);
}
$(document).ready(function() {
var a=\"szolg5\"; //it will be \"user defined\", used in getURL.php
getTargetUrl(a);
alert(imgPath);
});
</script>
// SNIPPET:
<?php
if(isset($_POST[\"x\"])){
$queryGlob='img/'.$_POST[\"x\"].'/batch/*.jpg';
foreach (glob($queryGlob) as $filename) {
$imgFiles=json_encode($filename);
$imgFiles=str_replace('\\/','/',$imgFiles);
echo $imgFiles;
}
//$data = str_replace('\\\\/', '/', json_encode(glob('img/'.$_POST[\"x\"].'/batch/*.jpg')));
}
else{
$imgFiles=\"FAIL\";
echo $imgFiles;
}
?>
// SNIPPET:
string WindowOpen = \"window.open('Notes.aspx?NoteTableId=\" + id +
\"&NoteTable=\" + Tables.InvoiceHeader + \"',
'theWin', 'width=200,height=200,toolbar=0,menubar=0');\";
// SNIPPET:
The name 'id' does not exist in the current context
The name 'Tables' does not exist in the current context
// SNIPPET:
change()
// SNIPPET:
$('#element').change( function(){
// do something on change
// $('#milestonesSelect').multiselect({ minWidth: 120 , height : '200px' ,selectedList: 4 }).multiselectfilter();
// some animation calls ...
// ...
}, function(){
// do something after complete
alert('another codes has completed when i called');
}
);
// SNIPPET:
<!DOCTYPE html>
<meta charset=\"utf-8\">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.x.axis path {
display: none;
}
.line {
fill: none;
stroke: steelblue;
stroke-width: 1.5px;
}
</style>
</head>
<body>
<script src=\"http://d3js.org/d3.v3.js\" charset=\"utf-8\"></script>
<script>
var margin = {top: 20, right: 20, bottom: 30, left: 50},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var parseDate = d3.time.format(\"%d-%b-%y\").parse;
var x = d3.time.scale()
.range([0, width]);
var y = d3.scale.linear()
.range([height, 0]);
var xAxis = d3.svg.axis()
.scale(x)
.orient(\"bottom\");
var yAxis = d3.svg.axis()
.scale(y)
.orient(\"left\");
var line = d3.svg.line()
.x(function(d) { return x(d.date); })
.y(function(d) { return y(d.close); });
var svg = d3.select(\"body\").append(\"svg\")
.attr(\"width\", width + margin.left + margin.right)
.attr(\"height\", height + margin.top + margin.bottom)
.append(\"g\")
.attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");
var data = [{\"close\":71,\"date\":\"9-Apr-13\"},{\"close\":14,\"date\":\"9-Apr-13\"},{\"close\":10,\"date\":\"9-Apr-13\"},{\"close\":109,\"date\":\"9-Apr-13\"},{\"close\":62,\"date\":\"9-Apr-13\"},{\"close\":61,\"date\":\"9-Apr-13\"},{\"close\":62,\"date\":\"9-Apr-13\"},{\"close\":32,\"date\":\"9-Apr-13\"},{\"close\":19,\"date\":\"9-Apr-13\"}];
data.forEach(function(d) {
d.date = parseDate(d.date);
d.close = +d.close;
});
x.domain(d3.extent(data, function(d) { return d.date; }));
y.domain(d3.extent(data, function(d) { return d.close; }));
svg.append(\"g\")
.attr(\"class\", \"x axis\")
.attr(\"transform\", \"translate(0,\" + height + \")\")
.call(xAxis);
svg.append(\"g\")
.attr(\"class\", \"y axis\")
.call(yAxis)
.append(\"text\")
.attr(\"transform\", \"rotate(-90)\")
.attr(\"y\", 6)
.attr(\"dy\", \".71em\")
.style(\"text-anchor\", \"end\")
.text(\"Price ($)\");
svg.append(\"path\")
.datum(data)
.attr(\"class\", \"line\")
.attr(\"d\", line);
</script>
</body>
</html>
// SNIPPET:
PanelBar
// SNIPPET:
<ul id='panelbar'>
<li class='k-state-active'> <span class='k-link k-state-selected'>Tab 1 <input type=\"checkbox\" class=\"cbSelect\"/></span>
<div>Test 1</div>
</li>
<li> <span class='k-link k-state-selected'> Tab2 <input type=\"checkbox\" class=\"cbSelect\"/></span>
<div>Test 2</div>
</li>
</ul>
// SNIPPET:
var app = require('express')()
, server = require('http').createServer(app)
, io = require('socket.io').listen(server);
// SNIPPET:
server.listen(1337);
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
// SNIPPET:
server.use(\"/\", app.static(__dirname + '/'));
// SNIPPET:
function move(where){
var status = document.querySelector(\"#status\");
var img = document.querySelector(\"img\");
switch(where){
case \"north\":
if(startingPos>=3){
startingPos -= 3;
status.innerHTML = messages[startingPos];
img.setAttribute(\"src\",images[startingPos]);
}else{
status.innerHTML = blockedPathMsg[startingPos];
}
break;
case \"east\":
if(startingPos%3!=2){
startingPos += 1;
status.innerHTML = messages[startingPos];
img.setAttribute(\"src\",images[startingPos]);
}else{
status.innerHTML = blockedPathMsg[startingPos];
}
break;
case \"west\":
if(startingPos%3!=0){
startingPos -= 1;
status.innerHTML = messages[startingPos];
img.setAttribute(\"src\",images[startingPos]);
}else{
status.innerHTML = blockedPathMsg[startingPos];
}
break;
case \"south\":
if(startingPos<6){
startingPos += 3;
status.innerHTML = messages[startingPos];
img.setAttribute(\"src\",images[startingPos]);
}else{
status.innerHTML = blockedPathMsg[startingPos];
}
break;
default:
status.innerHTML = \"I do not know that\";
}
}
// SNIPPET:
status.innerHTML
// SNIPPET:
<div id=\"userRegistration\"> <!-- Registration Form Shell -->
<form name=\"registration\">
<div id=\"leftSideForm\"> <!-- Left side of the Registration Form -->
<span style=\"color:red\">*</span>
Enter a Username: <input type=\"text\" name=\"userName\" /> <br />
<b id=\"yy\">test </b> <br />
<span style=\"color:red\">*</span>
Enter Password: <input type=\"password\" name=\"userPassword\" /><br />
<span style=\"color:red\">*</span>
Confirm Password: <input type=\"password\" name=\"cUserPassword\" /><br /> <br /> <br />
<span style=\"color:red\">*</span>
First name: <input type=\"text\" name=\"firstName\" /><br />
Middle initial: <input type=\"text\" name=\"middleName\" /><br />
<span style=\"color:red\">*</span>
Last name: <input type=\"text\" name=\"lastName\" /><br /> <br />
</div> <!-- end of Left sideform -->
<div id=\"rightSideForm\">
<span style=\"color:red\">*</span>
Email Address: <input type=\"text\" name=\"userEmail\" /><br />
<span style=\"color:red\">*</span>
Confirm Email: <input type=\"text\" name=\"confirmUserEmail\" /><br /> <br /> <br /> <br />
<button type=\"submit\" onclick=\"validateUsername()\" >Register</button>
</div> <!-- end of right sideform -->
</form>
</div> <!-- End of registration -->
<script type=\"text/javascript\">
function validateUsername()
{
var x=document.forms[\"registration\"][\"userName\"].value;
if (x == null || x== \"\")
{
document.getElementById(\"yy\").innerHTML = \"WHY WON'T YOU WORK GRRRR\";
alert(\"First name must be filled out\");
}
}
</script>
// SNIPPET:
<div id=\"test\" class=\"popup\">
// SNIPPET:
function openPopup()
{
document.getElementById('test').style.display = 'block';
}
// SNIPPET:
this.use(Sammy.Template, 'tpl');
this.get('#/:page', function() {
// render a template
// this.load()
this.render('templates/' + this.params['page'] + '.tpl').swap();
});
// SNIPPET:
function putStringTwo(k){
var table=document.getElementById(\"st2\");
var tbody=document.createElement(\"tbody\");
tbody.setAttribute(\"id\",\"2td2\");
var sCell=new Array(12);
var sRow=new Array(12);
for(var i=0;i<12;i++){
sCell[i]=document.createElement(\"td\");
sCell[i].setAttribute(\"name\",k[i]); //error happens here
sCell[i].innerHTML=k[i];
sCell[i].setAttribute(\"id\",\"two\"+i);
}
for(var i=0;i<12;i++){
sRow[i]=document.createElement(\"tr\");
sRow[i].appendChild(sCell[i]);
tbody.appendChild(sRow[i]);
}
table.appendChild(tbody);
for(var i=0;i<12;i++)
$('#two'+i).addClass(\"drag\");
}
// SNIPPET:
//here is the part of php code used for generate a javascript function
<?php
$counter=0;
$flag=array();
$numdatabasekey=12;
for($counter=1;$counter<=$numdatabasekey;$counter++)
$flag[$counter]=0;
$counter=0;
while($counter<12){
$number=rand(1,$numdatabasekey);
if($flag[$number]==0){
$keynum[$counter]=$number;
$flag[$number]=1;
$counter++;
}
}
$keyword=array();
if(!($database=mysql_connect(\"mysql.comp.polyu.edu.hk\",\"xxxxxxxxxxx\",\"xxxxxxxxxx\")))
die(\"Unable to connect to database </body></html>\");
if(!mysql_select_db(\"10821473d\",$database))
die(\"unable to open 10821473d database </body></html>\");
for($counter=0;$counter<12;$counter++){
$query=\"SELECT * FROM Keyword WHERE id=$keynum[$counter]\";
if(!($result=mysql_query($query,$database))){
print(\"could not execute query <br/>\");
die(mysql_error().\"</body></html>\");
}
$row=mysql_fetch_row($result);
$keyword[$counter]=$row[1];
}
mysql_close($database);
$javascript=<<<JS
function putImageTwo(){
var table=document.getElementById(\"tb2\");
var tbody=document.createElement(\"tbody\");
tbody.setAttribute(\"id\",\"2td\");
var imageTag=new Array(12);
var imageCell=new Array(12);
var imageRow=new Array(4);
var keyword=new Array(12);
// 1 get key word from database
JS;
for($i=0;$i<12;$i++){
$javascript.=\"keyword[$i]='$keyword[$i]';\";
}
$javascript.=<<<JS
putStringTwo(keyword);
// SNIPPET:
<script type=\"text/javascript\">
function validator(){
var name = document.KageForm.User.value;
var password= document.KageForm.pass.value;
if(password==\"mypassword\" && name==\"myusername\"|| password==\"myteacherspassword\" &&name==\"myteachersname\" ){
document.write(showbuttons());
} else {
document.write(\"This is not meant for you to see.\");
}}
</script>
// SNIPPET:
function showbuttons(){
document.write(\"<div><form><input type=\\\"button\\\" value=\\\"Starting Your Script\\\" onclick=\\\"FirstThingsFirst()\\\"/><br/><input type=\\\"button\\\" value=\\\"Learn about document.write\\\" onclick=\\\"writing()\\\" /><br/><input type=\\\"button\\\" value=\\\"Variables\\\"onclick=\\\"settingVariables()\\\" /><br/><input type=\\\"button\\\" value=\\\"Using Functions\\\" onclick=\\\"usingFunctions()\\\" /><br/><input type=\\\"button\\\" value=\\\"If Statements\\\" onclick=\\\"usingIfStatements()\\\" /><br/><input type=\\\"button\\\" value=\\\"Else Statements\\\" onclick=\\\"usingElseStatements()\\\" /><br/><input type=\\\"button\\\" value=\\\"Return to Login\\\" onclick=\\\"homepage()\\\" /></form></div>\")
document.body.style.backgroundImage=\"url('https://fc04.deviantart.net/fs70/f/2013/029/6/8/smoke_by_kage_kaldaka-d5t50d9.jpg')\";
document.getElementById('thisshouldbewhite').style.color=\"white\";
document.getElementById('thisshouldbewhite').style.width=\"400px\";
document.getElementById('thisshouldbewhite').style.fontFamily=\"helvetica\";
}
// SNIPPET:
<!doctype html>
<html>
<head>
<style type=\"text/css\">
body {background-image:url(https://fc04.deviantart.net/fs70/f/2013/029/6/8/smoke_by_kage_kaldaka-d5t50d9.jpg)}
body{
font-family:helvetica;
color:darkviolet;
}
h2 {color:darkviolet;}
#tag1 {width:480px;}
#wrapper { width:960px;margin:0 auto; }
}
div {
margin: 5px;
border: 5px solid darkviolet;
width:50%;
}
img {
width:20.00%;
height:20.00%;
}
ul li a {
margin: 10px;
padding: 2px;
background: #f2a7c6;
float: left;
border: 2px ;
}
a:link {text-decoration:none
color:darkviolet;}
h3 {
font-family:helvetica;
color:darkviolet
}
#white {
color:white;
}
</style>
<script type=\"text/javascript\">
/*<input type=\\\"button\\\" value=\\\"Starting Your Script\\\" onclick=\\\"FirstThingsFirst()\\\"/><br/><input type=\\\"button\\\" value=\\\"Learn about document.write\\\" onclick=\\\"writing()\\\" /><br/><input type=\\\"button\\\" value=\\\"variables\\\"onclick=\\\"settingVariables()\\\" /><br/>input type=\\\"button\\\" value=\\\"Using Functions\\\" onclick=\\\"usingFunctions()\\\" /><br/>input type=\\\"button\\\" value=\\\"If Statements\\\" onclick=\\\"usingIfStatements()\\\" /><br/>input type=\\\"button\\\" value=\\\"Else Statements\\\" onclick=\\\"usingElseStatements()\\\" />*/
function FirstThingsFirst() {
var mytext = \"<div id=\\\"thisshouldbewhite\\\"> To start writing Javascript into your page, you must first make use of the script tag. The tag is 'script' type=\\\"text/javascript\\\" with the closing tag simply being /script. you can use a Javascript either in your heading of your page, after the style tag, or anywhere in your body. Personally, I prefer to put all my script, or at least my functions, in the head of my page.</div> <input type=\\\"button\\\" value=\\\"Return to Home\\\" onclick=\\\"homepage()\\\" />\"
document.write(mytext);
document.body.style.backgroundImage=\"url('https://fc04.deviantart.net/fs70/f/2013/029/6/8/smoke_by_kage_kaldaka-d5t50d9.jpg')\";
document.getElementById('thisshouldbewhite').style.color=\"white\";
document.getElementById('thisshouldbewhite').style.width=\"400px\";
document.getElementById('thisshouldbewhite').style.fontFamily=\"helvetica\";
}
function writing()
{
var mytext = \"<div id=\\\"thisshouldbewhite\\\">To write something out on your screen, you use the command \\'document.write()'. To get what you want to appear, put qutation marks around it in the paranthesis. So to write out \\\"bacon\\\", you would put: document.write(\\\"bacon\\\") in your script. Document.write() is used for many things, mainly displaying information based on input data given to the page by the user that fits into variables defined by the creator of the page. For example, document.write(variableX()) would print out anything that has been put in for variableX.</div><input type=\\\"button\\\" value=\\\"Return to Home\\\" onclick=\\\"homepage()\\\" />\"
document.write(mytext);
document.body.style.backgroundImage=\"url('https://fc04.deviantart.net/fs70/f/2013/029/6/8/smoke_by_kage_kaldaka-d5t50d9.jpg')\";
document.getElementById('thisshouldbewhite').style.color=\"white\";
document.getElementById('thisshouldbewhite').style.width=\"400px\";
document.getElementById('thisshouldbewhite').style.fontFamily=\"helvetica\";
}
function settingVariables(){
document.write(\"<div id=\\\"thisshouldbewhite\\\">to create a variable, youtype in \\'var\\' followed by a space, then the name of the variable, an = then what the variable is equal to. So, if you had food on your mind and wanted your variable to be \\'bacon\\' your variable would be: var food=\\\"bacon\\\"</div><input type=\\\"button\\\" value=\\\"Return to Home\\\" onclick=\\\"homepage()\\\" />\")
document.body.style.backgroundImage=\"url('https://fc04.deviantart.net/fs70/f/2013/029/6/8/smoke_by_kage_kaldaka-d5t50d9.jpg')\";
document.getElementById('thisshouldbewhite').style.color=\"white\";
document.getElementById('thisshouldbewhite').style.width=\"400px\";
document.getElementById('thisshouldbewhite').style.fontFamily=\"helvetica\";
}
function usingFunctions(){
document.write(\"<div id=\\\"thisshouldbewhite\\\">Functions are used to use commands only when triggered, or to do multiple things at once. for example, open up a website and type in the following code: <br/> <i>function troll(){<br/>document.write(\\\"gotcha!\\\");<br/>document.write(gotcha());<br/> function gotcha(){<br/>document.write(\\\" hahahaha!\\\");<br/>document.write(troll())</i>;<br/> What this will do is that the first function will call the second function, and then when the second function is called it will call the first function.Since neither are being called at the moment, create a button in your html as usual, but in the starting tag, add the property\\\"onClick\\\". Name your button something like, 'start trolling' or something like that. So, your code for your input should look something like <i><-input type=\\\"button\\\" value=\\\"Starting Your Script\\\" onclick=\\\"FirstThingsFirst()\\\"/></i> <br/> obviously minus the dash at the start of the tag.</br><input type=\\\"button\\\" value=\\\"Commence Trolling\\\" onclick=\\\"troll()\\\"/></div><input type=\\\"button\\\" value=\\\"Return to Home\\\" onclick=\\\"homepage()\\\" />\");
document.body.style.backgroundImage=\"url('https://fc04.deviantart.net/fs70/f/2013/029/6/8/smoke_by_kage_kaldaka-d5t50d9.jpg')\";
document.getElementById('thisshouldbewhite').style.color=\"white\";
document.getElementById('thisshouldbewhite').style.width=\"400px\";
document.getElementById('thisshouldbewhite').style.fontFamily=\"helvetica\";
}
function usingIfStatements(){
document.write(\"<div id=\\\"thisshouldbewhite\\\">If statements are used to create scenarios such as login screens, since that is the use that will be most familiar to most of us. An If statement goes inside the function tag, so when in use the statement looks like this:<br/>function login(){<br/>if(conditions for if statement){commands for if statement to follow}}<br/> Here is an example of a functional function using an IF Statement:<br/>function login(){<br/>var name=\\\"your name\\\";<br/>if(name==\\\"your name\\\"){document.write(\\\"You are indeed yourself\\\")}}<br/>This would print out the words in the command following the If statement, since the statement is true, since the variable, \\\"name\\\" is equal to \\\"your name\\\"</div><input type=\\\"button\\\" value=\\\"Return to Home\\\" onclick=\\\"homepage()\\\" />\");
document.body.style.backgroundImage=\"url('https://fc04.deviantart.net/fs70/f/2013/029/6/8/smoke_by_kage_kaldaka-d5t50d9.jpg')\";
document.getElementById('thisshouldbewhite').style.color=\"white\";
document.getElementById('thisshouldbewhite').style.width=\"400px\";
document.getElementById('thisshouldbewhite').style.fontFamily=\"helvetica\";
}
function usingElseStatements(){
document.write(\"<div id=\\\"thisshouldbewhite\\\">So, we know how to make an If statement, now we are going to use Else statements. This would be like on a login screen, if you type in inaccurate information and it gives you an error message<i><br/>function login(){<br/>if(conditions for if statement){commands for if statement to follow}else(commands for script to follow if your If statement is not true)}</i><br/> Here is an example of a functional function using an IF Statement:<i><br/>function login(){<br/>var name=\\\"your name\\\";<br/>if(name==\\\"your name\\\"){document.write(\\\"You are indeed yourself\\\")else{document.write(\\\"you are not yourself when you're hungry.\\\")}}}<br/></i></div>\")
document.body.style.backgroundImage=\"url('https://fc04.deviantart.net/fs70/f/2013/029/6/8/smoke_by_kage_kaldaka-d5t50d9.jpg')\";
document.getElementById('thisshouldbewhite').style.color=\"white\";
document.getElementById('thisshouldbewhite').style.width=\"400px\";
document.getElementById('thisshouldbewhite').style.fontFamily=\"helvetica\";
}
function troll(){
document.write(\"gotcha!\");
document.write(gotcha());
}
function gotcha(){
document.write(\" hahahaha!\");
document.write(troll())
}
function homepage()
{
window.location.href = \"file:///C:/Users/Admin/Documents/Websites/TEst.html\";
}
function gotoButtons()
{
window.location.href = \"file:///C:/Users/Admin/Documents/Websites/Buttons.html\";
}
function showbuttons(){
document.write(\"<div><form><input type=\\\"button\\\" value=\\\"Starting Your Script\\\" onclick=\\\"FirstThingsFirst()\\\"/><br/><input type=\\\"button\\\" value=\\\"Learn about document.write\\\" onclick=\\\"writing()\\\" /><br/><input type=\\\"button\\\" value=\\\"Variables\\\"onclick=\\\"settingVariables()\\\" /><br/><input type=\\\"button\\\" value=\\\"Using Functions\\\" onclick=\\\"usingFunctions()\\\" /><br/><input type=\\\"button\\\" value=\\\"If Statements\\\" onclick=\\\"usingIfStatements()\\\" /><br/><input type=\\\"button\\\" value=\\\"Else Statements\\\" onclick=\\\"usingElseStatements()\\\" /><br/><input type=\\\"button\\\" value=\\\"Return to Login\\\" onclick=\\\"homepage()\\\" /></form></div>\")
document.body.style.backgroundImage=\"url('https://fc04.deviantart.net/fs70/f/2013/029/6/8/smoke_by_kage_kaldaka-d5t50d9.jpg')\";
document.getElementById('thisshouldbewhite').style.color=\"white\";
document.getElementById('thisshouldbewhite').style.width=\"400px\";
document.getElementById('thisshouldbewhite').style.fontFamily=\"helvetica\";
}
</script>
</head>
<body>
<script type=\"text/javascript\">
function validator(){
var name = document.KageForm.User.value;
var password= document.KageForm.pass.value;
if(password==\"mypassword\" && name==\"myusername\"|| password==\"myteacherspassword\" &&name==\"myteachersname\" ){
document.write(showbuttons());
} else {
document.write(\"This is not meant for you to see.\");
}}
</script>
<form name=\"KageForm\">
Username:<input type=\"text\" name=\"User\">
<br/>
Password: <input type=\"password\" name=\"pass\">
<br/>
<input type=\"image\" src=\"https://a.deviantart.net/avatars/k/a/kage-kaldaka.png?6\"
value=\"Submit\" onclick=\"validator()\" />
<br/>
<input type=\"button\" value=\"Starting Your Script\" onclick=\"FirstThingsFirst()\"/>
<br/>
<input type=\"button\" value=\"Learn about document.write\" onclick=\"writing()\" />
<br/>
<input type=\"button\" value=\"Variables\"
onclick=\"settingVariables()\" />
<br/>
<input type=\"button\" value=\"Using Functions\" onclick=\"usingFunctions()\" />
<br/>
<input type=\"button\" value=\"If Statements\" onclick=\"usingIfStatements()\" />
<br/>
<input type=\"button\" value=\"Else Statements\" onclick=\"usingElseStatements()\" />
<br/>
<input type=\"button\" value=\"\" onclick=\"\" />
<br/>
<input type=\"button\" value=\"\" onclick=\"()\" />
<br/>
<input type=\"button\" value=\"\" onclick=\"()\" />
<br/>
<input type=\"button\" value=\"\" onclick=\"()\" />
</form>
</body>
</html>
// SNIPPET:
#one
// SNIPPET:
<div id=\"one\" class=\"thing\"></div>
<div id=\"two\" class=\"thing\"></div>
<div id=\"three\" class=\"thing\"></div>
<script>
jQuery(function($) {
$('.thing').data('obj',{a:'a'});
$('#one').data('obj',$.extend($('#one').data('obj'),{one:'one'}));
//Display:
for (i in $('#one').data('obj')) {
alert(i+' in obj.');
}
for (i in $('#two').data('obj')) {
alert(i+' in obj.');
}
})
</script>
// SNIPPET:
console.log()
// SNIPPET:
<table>
<thead>
<tr class=\"body\">
<th class=\"checkbox\"><input class=\"forecast first\" name=\"1\" type=\"checkbox\"></th>
<th class=\"checkbox\"><input class=\"forecast second\" name=\"2\" type=\"checkbox\"></th>
<th class=\"checkbox\"><input class=\"forecast third\" name=\"3\" type=\"checkbox\"></th>
<th class=\"checkbox\"><input class=\"forecast any\" name=\"any\" type=\"checkbox\"></th>
</tr>
</thead>
<tbody>
<tr class=\"body\">
<td class=\"checkbox\"><input class=\"forecast first\" name=\"1\" type=\"checkbox\"></td>
<td class=\"checkbox\"><input class=\"forecast second\" name=\"2\" type=\"checkbox\"></td>
<td class=\"checkbox\"><input class=\"forecast third\" name=\"3\" type=\"checkbox\"></td>
<td class=\"checkbox\"><input class=\"forecast any\" name=\"any\" type=\"checkbox\"></td>
</tr>
<tr class=\"body\">
<td class=\"checkbox\"><input class=\"forecast first\" name=\"1\" type=\"checkbox\"></td>
<td class=\"checkbox\"><input class=\"forecast second\" name=\"2\" type=\"checkbox\"></td>
<td class=\"checkbox\"><input class=\"forecast third\" name=\"3\" type=\"checkbox\"></td>
<td class=\"checkbox\"><input class=\"forecast any\" name=\"any\" type=\"checkbox\"></td>
</tr>
</tbody>
</table>
// SNIPPET:
oncheck: function(checkbox) {
if ($(checkbox).prop(\"checked\")) { // checking
if ($(checkbox).hasClass('first')) {
$('.forecast[value=\"' + checkbox.value +'\"]').prop(\"checked\", false); // unmarking checkboxes in this row
$('.forecast.first').prop(\"checked\", false); // unmarking checkboxes in this column
$('.forecast.any').prop(\"checked\", false); // unmarking checkboxes in Any order column
$(checkbox).prop(\"checked\", true);
}
if ($(checkbox).hasClass('second')) {
if ($('.forecast.first[value!=\"' + checkbox.value + '\"]:checked').length > 0 ) {
$('.forecast.second').prop(\"checked\", false); // unmarking checkboxes in this column
$('.forecast.third[value=\"' + checkbox.value +'\"]').prop(\"checked\", false); // unmarking 3rd checkboxes in this row
$(checkbox).prop(\"checked\", true);
} else {
$(checkbox).prop(\"checked\", false);
}
}
if ($(checkbox).hasClass('third')) {
if ($('.forecast.first[value!=\"' + checkbox.value + '\"]:checked').length > 0 &&
$('.forecast.second[value!=\"' + checkbox.value + '\"]:checked').length > 0) {
$('.forecast.third').prop(\"checked\", false); // unmarking checkboxes in this column
$(checkbox).prop(\"checked\", true);
} else {
$(checkbox).prop(\"checked\", false);
}
}
if ($(checkbox).hasClass('any')) {
// unmarking checkboxes in columns : 1st 2nd 3rd
$('.forecast.first').prop(\"checked\", false);
$('.forecast.second').prop(\"checked\", false);
$('.forecast.third').prop(\"checked\", false);
$(checkbox).prop(\"checked\", true);
}
}
else {
if ($(checkbox).hasClass('first')) {
$('.forecast').prop(\"checked\", false); // unchecking all
}
if ($(checkbox).hasClass('second')) {
$('.forecast.third').prop(\"checked\", false); // unchecking all third class
}
}
}
};
// SNIPPET:
prop
// SNIPPET:
attr
// SNIPPET:
id
// SNIPPET:
id
// SNIPPET:
<div id=\"selDe\">
<input type=\"radio\" class=\"ger\" id=\"num1\" checked><label for=\"num1\">
<input type=\"radio\" class=\"ger\" id=\"num2\"><label for=\"num2\">
</div>
<div id=\"selRe\" >
<input type=\"radio\" class=\"ger\" id=\"num1\" checked><label for=\"num1\">
<input type=\"radio\" class=\"ger\" id=\"num2\"><label for=\"num2\">
// SNIPPET:
<script>
$(\".ger\").on({
click:function(){
var pid = $(this).parent().attr(\"id\"); //get the name of the div parent
$(\"#\"+pid+\" .ger\").on({
//execute the function, but it just works after the next click
click: function () {
var showV = this.id.slice(3);
alert(showV)
}
});
}
});
// SNIPPET:
opener.document.profile.inp_type.value = val2;
window.close();
// SNIPPET:
<input type=\"text\" value=\"\" id=\"inp_type\" name=\"inp_type\" /> <img src=\"\" onclick=\"openPopUp()\" />
<select name=\"sel1\" id=\"sel1\" >
<!--
When the textbox get the id from popup window, I need to load some data here.
-->
</select>
// SNIPPET:
[1,2,3,[1,2,3,[1,2,3]],4,5,[1,2],[[1,2],[1,2]],[1],[1]]
// SNIPPET:
<a href=\"#\" class=\"loadpage\">1.1</a>
<a href=\"#\" class=\"loadpage\">1.2</a>
<a href=\"#\" class=\"loadpage\">1.3</a>
// SNIPPET:
$('.loadpage').click(function(){
alert('test');
});
// SNIPPET:
cursor:url(...)
// SNIPPET:
$('<div/>').css({}).addClass()
// SNIPPET:
<div id=\"row1\">
<div class=\"type_3\">
</div>
<div class=\"type_1\">
</div>
<div class=\"type_2\">
</div>
<div class=\"type_2\">
</div>
</div>
// SNIPPET:
<br><label id=\"cancelphoneLabel\">1-800-555-1111</label>
<br><label id=\"mdamountLabel\">Monthly Donation:
<td>
<input type=\"text\" id=\"mdamountBox\" style=\"width:50px;\" name=\"md_amt\" value=\"\" placeholder=\"Monthly\" onkeyup=\"monthlycheck()\" autocomplete=\"off\">
<br><label id=\"mnthlychkdiscoLabel\">&nbsp;</label>
// SNIPPET:
function monthlycheck() {
var mnthchk = document.getElementById(\"mdamountBox\").innerHTML; <
// SNIPPET:
i want to pass the value of this box
var cancelPhone = document.getElementById(\"cancelphoneLabel\").innerHTML;
if (mnthchk.value != \"\") {
var newHTML = \"<span style='color:#24D330'> Your Monthly pledge in the amount of $<label id='dollarLabel'>&nbsp;</label> is valid and will be deducted this time every month<br> untill you notify us of its cancellation by calling <label id='cancelphonelistLabel'>&nbsp;</label> </span>\";
document.getElementById(\"mnthlychkdiscoLabel\").innerHTML = newHTML;
document.getElementById(\"cancelphonelistLabel\").innerHTML = cancelPhone;
document.getElementById(\"dollarLabel\").innerHTML = mnthchk; <
// SNIPPET:
-passed to here
// SNIPPET:
$('nav > ul > li > a').on('mouseenter',function(e){
var currentID = this;
var index = $('ul.topnav > li > a').index(this);
$(this).addClass('selected');
$('nav ul ul').css('margin-top',(38*parseInt(index)));
$(this).parent().find('ul').on('mouseenter',function(e){
//fire several times
console.log('hover');
$(currentID).addClass('selected');
}).on('mouseleave',function(e){
$(currentID).removeClass('selected');
//fire several times
console.log('end hover');
});
}).on('mouseleave',function(e){
$(this).removeClass('selected');
);
// SNIPPET:
String videoHtml = \"<iframe frameborder='0' src='http://www.dailymotion.com/embed/video/video_id'></iframe>
content.loadData(videoHtml, \"text/html\", \"utf-8\");
// SNIPPET:
$.ajax({
type: \"POST\",
url: \"agenda/data\",
data: { title : title}
});
// SNIPPET:
{
\"manifest_version\": 2,
\"name\": \"Email extractor\",
\"description\": \"Extracts data from emails\",
\"version\": \"1.0\",
\"background\": {
\"script\": \"background.js\"
},
\"content_scripts\": [
{
\"matches\": [
\"*://mail.google.com/*\",
\"*://*/*\"
],
\"js\": [
\"lib/yepnope.js/yepnope.1.5.4-min.js\",
\"lib/bootstrap.js\",
\"main.js\",
\"gmailr.js\",
\"content.js\"
],
\"css\": [
\"main.css\"
],
\"run_at\": \"document_end\"
}
],
\"permissions\": [
\"tabs\",
\"storage\",
\"background\",
\"*://mail.google.com/*\",
\"*://*/*\"
],
\"browser_action\": {
\"default_icon\": \"img/icon.png\",
\"default_popup\": \"popup.html\"
},
\"web_accessible_resources\" : [
\"writeForm.js\",
\"disp.js\",
\"/calendar/jsDatePick.min.1.3.js\",
\"/calendar/jsDatePick_ltr.min.css\",
\"lib/gmailr.js\",
\"lib/jquery-bbq/jquery.ba-bbq.min.js\",
\"content.js\",
\"main.js\",
\"background.js\"
]
}
// SNIPPET:
Gmailr.init(function(G) {
sender = G.emailAddress();
G.insertTop($(\"<div id='gmailr'><span></span> <span id='status'></span>)\");
el = document.getElementById(\"testid\");
el.addEventListener('click', mg, false);
var status = function(msg) {
G.$('#gmailr #status').html(msg); };
G.observe(Gmailr.EVENT_COMPOSE, function(details) {
....
status(\" user: \" + user);
console.log('user:', user);
//now try to send a message to the background page
//this always returns the error that method sendMessage does not exist for undefined
chrome.runtime.sendMessage({greeting: \"test from gmailr\"}, function(response) {
console.log(\"did it send?\");
});
});
});
// SNIPPET:
<!DOCTYPE HTML>
<html lang=\"en-US\">
<head>
</head>
<body>
<form>
<input type=\"input\" id=\"inp\">
<input type =\"button\" id=\"mybutton\" value =\"Dell\">
</form>
</body>
</html>
// SNIPPET:
$('.cde').click(function(){
var n_window = window.open(\"submit.html\");
$(n_window).ready(function(){
$('#inp').focus(function(){
$('#mybutton').val('cns');
})
})
})
// SNIPPET:
var element=null;
$.ajax({
type: 'GET',
async: false,
url: \"C:\\Users\\myDir\\Desktop\\Project\\jsonfile.json\",
dataType: 'json',
success : function(data) {
element=data;
}
});
// SNIPPET:
{
\"info\":[
{
\"a1\": \"Ram\",
\"b1\": \"P123\"
},
{
\"a1\": \"ROM\",
\"b1\": \"P245\"
}
]
}
// SNIPPET:
document.getElementById(\"inputField1\").value
// SNIPPET:
<input contenteditable=\"false\" id=\"inputField1\" type=\"text\" size=\"12\" style=\"background:#09F;color:#FFF;text-align:center\" value=\"Hello World!\"/>
// SNIPPET:
Hello World!
// SNIPPET:
alert
// SNIPPET:
<div id=\"inField001\">Hello World</div>
// SNIPPET:
for(var i=0; i<asteroids.length; i++){
if(player.x<asteroids[i].x+asteroids[i].radius){
if(player.x>asteroids[i].x-asteroids[i].radius){
if(player.y<asteroids[i].y+asteroids[i].radius){
if(player.y>asteroids[i].y-asteroids[i].radius){
player.lives-=Math.floor(Math.random()*(900000-600000)-600000);
}
}
}
}
}
// SNIPPET:
if($(\"#something\").html == \"New HTML\") //Returns false
if($(\"#something\").html == \"Old HTML\") //Returns true
console.log($(\"#something\").html) // Returns New HTML
// SNIPPET:
function Animal() {
// do something
}
Animal.prototype.walk = function() {
alert('I am walking.');
};
// SNIPPET:
function Lion() {
// do something
}
// SNIPPET:
Lion
// SNIPPET:
Animal
// SNIPPET:
Lion.prototype = new Animal();
// Set the constructor to Lion, because now it points to Animal
Lion.prototype.constructor = Lion;
// SNIPPET:
$.extend(Lion.prototype, Animal.prototype);
// SNIPPET:
$.extend
// SNIPPET:
function checkPasswordComplexity(pwd) {
var regularExpression = /^[a-zA-Z][0-9]$/;
var valid = regularExpression.test(pwd);
return valid;
}
// SNIPPET:
Password:Valid
a1:true
aa1:false
aa11:false
// SNIPPET:
Password:Valid
aa:false (should have at least 1 number)
1111111:false (should have at least 1 letter)
aa1:true
aa11:true
a1a1a1a1111:true
// SNIPPET:
setTimeout(function(){
bannerInterval = setInterval(function(){
bannerRotate();
},5000);
},5000);
bannerRotate();
// SNIPPET:
dojo
// SNIPPET:
Dialog
// SNIPPET:
Dialog
// SNIPPET:
html
// SNIPPET:
Dialog
// SNIPPET:
Dialog
// SNIPPET:
DialogContent.html
// SNIPPET:
<div>
<table>
<tbody>
<tr>
<td>
<label for=\"printTitle\">Map Title:</label>
</td>
<td>
<input id=\"printTitle\" data-dojo-type=\"dijit/form/TextBox\" name=\"title\" />
</td>
</tr>
<tr>
<td>
<label for=\"printOrientation\">Page Orientation:</label>
</td>
<td>
<select id=\"printOrientation\" data-dojo-type=\"dijit/form/FilteringSelect\" name=\"orientation\">
<option value=\"Letter ANSI A Landscape\">Landscape</option>
<option value=\"Letter ANSI A Portrait\">Portrait</option>
</select>
</td>
</tr>
<tr>
<td>
<label for=\"printUnits\">Scale Bar Units:</label>
</td>
<td>
<select id=\"printUnits\" data-dojo-type=\"dijit/form/FilteringSelect\" name=\"units\">
<option value=\"Miles\">Miles</option>
<option value=\"Kilometers\">Kilometers</option>
<option value=\"Feet\">Feet</option>
<option value=\"Meters\">Meters</option>
</select>
</td>
</tr>
<tr>
<td>
<label for=\"printLayers\">Layers to Include in Legend:</label>
</td>
<td>
<select id=\"printLayers\" data-dojo-type=\"dijit/form/MultiSelect\" name=\"layers\"></select>
</td>
</tr>
</tbody>
</table>
<div>
<button data-dojo-type=\"dijit/form/Button\" type=\"submit\">OK</button>
</div>
</div>
// SNIPPET:
define([...,...,...,\"dojo/text!./PrintWidget/templates/DialogContent.html\"]...)
// SNIPPET:
#printLayers
// SNIPPET:
domConstruct.toDom(dialogContent)
// SNIPPET:
#printLayers
// SNIPPET:
dom.byId
// SNIPPET:
dojo/query
// SNIPPET:
#printLayers
// SNIPPET:
option
// SNIPPET:
<script src=\"https://maps.google.com/maps/api/js?sensor=false&libraries=places\" type=\"text/javascript\"></script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(-33.8688, 151.2195);
var mapOptions = {
center: new google.maps.LatLng(-33.8688, 151.2195),
zoom: 17,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map_auto'), mapOptions);
var input = document.getElementById('event_input_auto');
var autocomplete = new google.maps.places.Autocomplete(input);
autocomplete.bindTo('bounds', map);
var infowindow = new google.maps.InfoWindow();
marker = new google.maps.Marker({
position: myLatlng,
map: map
});
/*new added*/
google.maps.event.addListener(map, 'center_changed', function() {
var location = map.getCenter();
//new added
placeMarker(location);
displayLocation(location.lat(),location.lng());
});
google.maps.event.addListener(map, 'zoom_changed', function() {
zoomLevel = map.getZoom();
});
google.maps.event.addListener(marker, 'dblclick', function() {
zoomLevel = map.getZoom()+1;
if (zoomLevel == 20) {
zoomLevel = 10;
}
map.setZoom(zoomLevel);
});
/*new added*/
google.maps.event.addListener(autocomplete, 'place_changed', function() {
$('#map_holder').show();
google.maps.event.addListenerOnce(map, 'idle', function(){
google.maps.event.trigger(map, 'resize');
map.setCenter(location);
});
infowindow.close();
var place = autocomplete.getPlace();
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
map.setCenter(place.geometry.location);
map.setZoom(17); // Why 17? Because it looks good.
}
//alert(autocomplete.getBounds());
var image = new google.maps.MarkerImage(
place.icon, new google.maps.Size(71, 71),
new google.maps.Point(0, 0), new google.maps.Point(17, 34),
new google.maps.Size(35, 35));
marker.setIcon(image);
marker.setPosition(place.geometry.location);
var address = '';
if (place.address_components) {
address = [
(place.address_components[0] &&
place.address_components[0].short_name || ''),
(place.address_components[1] &&
place.address_components[1].short_name || ''),
(place.address_components[2] &&
place.address_components[2].short_name || '')].join(' ');
}
infowindow.setContent('<div><b>' + place.name + '</b><br>' + address);
infowindow.open(map, marker);
});
// Sets a listener on a radio button to change the filter type on Places
// Autocomplete.
var setupClickListener = function(id, types) {
var radioButton = document.getElementById(id);
google.maps.event.addDomListener(radioButton, 'click', function() {
autocomplete.setTypes(types);
});
}
setupClickListener('changetype-all', []);
//setupClickListener('changetype-establishment', ['establishment']);
//setupClickListener('changetype-geocode', ['geocode']);
}
google.maps.event.addDomListener(window, 'load', initialize);
function placeMarker(location) {
var clickedLocation = new google.maps.LatLng(location);
marker.setPosition(location);
}
function displayLocation(latitude,longitude){
var request = new XMLHttpRequest();
var method = 'GET';
var url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng='+latitude+','+longitude+'&sensor=true';
var async = true;
request.open(method, url, async);
request.onreadystatechange = function(){
if(request.readyState == 4 && request.status == 200){
var data = JSON.parse(request.responseText);
var address = data.results[0];
//document.write(address.formatted_address);
document.getElementById(\"event_input_auto\").value = address.formatted_address;
}
};
request.send();
};
</script>
<input type=\"text\" name=\"location\" class=\"input-xxlarge required\" id=\"event_input_auto\" value=\"\" />
<div id=\"map_holder\" style=\"display: none;\">
<div id=\"map_auto\" style=\"height: 300px; width: 800px;\" ></div>
</div>
// SNIPPET:
#map_holder
// SNIPPET:
display:block
// SNIPPET:
#map_holder
// SNIPPET:
display:none
// SNIPPET:
<asp:MultiView
id=\"MultiView1\"
ActiveViewIndex=\"1\"
Runat=\"server\">
<asp:View ID=\"View1\" runat=\"server\" >
<iframe id=\"v1\" runat=\"server\" src='http://www.w3schools.com' style=\"border: None; height: 100%; width: 100%;\"></iframe>
</asp:View>
<asp:View ID=\"View2\" runat=\"server\">
<iframe id=\"Iframe1\" runat=\"server\" src='http://www.w3schools.com/html/html5_intro.asp' style=\"border: None; height: 100%; width: 100%;\"></iframe>
</asp:View>
<asp:View ID=\"View3\" runat=\"server\">
<br />This is the third view
<br />This is the third view
<br />This is the third view
<br />This is the third view
</asp:View>
<asp:View ID=\"View4\" runat=\"server\">
<br />This is the third view
<br />This is the third view
<br />This is the third view
<br />This is the third view
</asp:View>
</asp:MultiView>
// SNIPPET:
//COMMENT HANDLING
$(\"#mondayCommentLink\").click(function () {
var mondayhtmls = $(\"#mondayComment\");
var input = $(\"<input type='text' id='mondayCommentText' name='mondayCommentText' size='10' />\");
input.val(data.days[0].comment);
mondayhtmls.html(input);
});
$(\"#tuesdayCommentLink\").click(function () {
var tuesdayhtmls = $(\"#tuesdayComment\");
var inputt = $(\"<input type='text' id='tuesdayCommentText' name='tuesdayCommentText' size='10' />\");
inputt.val(data.days[1].comment);
tuesdayhtmls.html(inputt);
});
$(\"#wednesdayCommentLink\").click(function () {
var htmls = $(\"#wednesdayComment\");
var input = $(\"<input type='text' id='wednesdayCommentText' name='wednesdayCommentText' size='10' />\");
input.val(data.days[2].comment);
htmls.html(input);
});
$(\"#thursdayCommentLink\").click(function () {
var htmls = $(\"#thursdayComment\");
var input = $(\"<input type='text' id='thursdayCommentText' name='thursdayCommentText' size='10' />\");
input.val(data.days[3].comment);
htmls.html(input);
});
$(\"#fridayCommentLink\").click(function () {
var htmls = $(\"#fridayComment\");
var input = $(\"<input type='text' id='fridayCommentText' name='fridayCommentText' size='10' />\");
input.val(data.days[4].comment);
htmls.html(input);
});
$(\"#saturdayCommentLink\").click(function () {
var htmls = $(\"#saturdayComment\");
var input = $(\"<input type='text' id='saturdayCommentText' name='saturdayCommentText' size='10' />\");
input.val(data.days[5].comment);
htmls.html(input);
});
// SNIPPET:
var windowObjectReference = window.open(strUrl, strWindowName[, strWindowFeatures]);
// SNIPPET:
<input type=\"button\" value=\"OPEN\" onclick=\"window.open('http://localhost:8085/reports/popupData.jsp','Select Language','modal=yes,dialog=yes,width=200,height=360,resizable=no');\" />
<p id=\"text\">Selected Languages are:</p>
// SNIPPET:
<tr valign=\"top\" id=\"branchNameTr\">
<td class=\"td-label\" id=\"branchNameTd\">*Branch Name:</td>
<td nowrap=\"\" cellpadding=\"0\" class=\"td-input\" style=\"padding-left:10px;float:left\">
<span id=\"branchName\" style=\"float: left\"></span>
<img border=\"0\" alt=\"Branch Name \" id=\"branchTooltip\" style=\"float:left;padding-left:5px\" src=\"images/info2.jpg\">
</td>
</tr>
// SNIPPET:
createRelease.branchNameList = new Ext.form.ComboBox({
name : 'branchName',
fieldLabel : 'Branch Name',
store : createRelease.branchNameListStore,
typeAhead : true,
mode : 'local',
forceSelection : true,
displayField : 'branchName',
valueField : 'branchNameId',
triggerAction : 'all',
emptyText : \"select branch\",
selectOnFocus : true,
minListWidth : \"178\",
renderTo : 'branchName'
});
// SNIPPET:
if (packageGroupName == 'MCP') {
document.getElementById(\"branchNameTr\").className = \"\";
createRelease.branchNameList.show();
createRelease.branchNameList.doLayout();
} else {
document.getElementById(\"branchNameTr\").className = \"hidden\";
createRelease.branchNameList.hide();
}
// SNIPPET:
var count = 0;
function counter() {
if (document.getElementById(\"generateid\").onclick) {
count++;
return count;
}
}
function padDigits(number, digits) {
return Array(Math.max(digits - String(number).length + 1, 0)).join(0) + number;
}
function generateID() {
if (document.getElementById(\"generateidtxt\").value == \"\") {
var TheTextBox = document.getElementById(\"generateidtxt\");
TheTextBox.value = TheTextBox.value + guidGenerator();
document.getElementById(\"generateid\").disabled = true;
}
}
function guidGenerator() {
var theID = (Year() + \"-\" + Month() + \"-\" + Day() + \"-\" + padDigits(counter(),4));
return theID;
}
<asp:Button ID=\"Button1\" runat=\"server\" Onclick = \"Button1_Click\"
OnClientClick = \"javascript:return SubmitForm();\"
Text=\"Submit\" Width=\"98px\"
/>
// SNIPPET:
<form action=\"\" method=\"POST\" id=\"contact\">
<table>
<tbody>
<tr>
<td><h2>First Name: </h2></td>
<td><h2>Last Name: </td>
<td><h2>Email Address: </td>
</tr>
<tr>
<td><input type=\"text\" name=\"first_name\"></td>
<td><input type=\"text\" name=\"last_name\"></td>
<td><input type=\"text\" name=\"email\"></td>
</tr>
<tr>
<td><h2>Street Address:</h2></td>
<td><h2>What's Dirty?</h2></td>
</tr>
<tr>
<td><input type=\"text\" name=\"address\"></td>
<td>
<select name=\"job\" form=\"contact\">
<option value=\"house\">House</option>
<option value=\"roof\">Roof</option>
<option value=\"garage-shed\">Garage/shed</option>
<option value=\"other\">Other</option>
</select>
</td>
</tr>
<tr>
<td><h2>Message: </h2></td>
</tr>
</tbody>
</table>
<textarea name=\"message\" cols=\"80\" rows=\"5\"></textarea>
<input type=\"submit\" id=\"submit\" name=\"send\" value=\"Send!\" class=\"send-button\">
</form>
// SNIPPET:
<script type=\"text/javascript\">
$(\"#submit\").click(function(e) {
e.preventDefault();
var data_string = $(\"form#contact\").serializeArray();
$.ajax({
type: \"POST\",
url: \"database.php\",
data: data_string,
success: function(){
}
});
return false;
});
</script>
// SNIPPET:
print_r($_POST);
$fname = $_POST['first_name'];
$lname = $_POST['last_name'];
$email = $_POST['email'];
$address = $_POST['address'];
$job = $_POST['job'];
$message = $_POST['message'];
// SNIPPET:
[first_name] => John
[last_name] => Smith
[email] => j.smith@example.com
[address] => 1234 Jamestown Rd.
// SNIPPET:
<div id=\"apple\">
<table width=\"30%\" height=\"2%\" cellpadding=\"0\" border=\"0px\" align=\"left\" >
<tbody>
<tr>
<td style=\"text-align:center\"><font face=\"Arial\">&nbsp;</font></td>
</tr>
</tbody>
</table>
</div>
// SNIPPET:
var ap = document.getElementById(\"apple\")
if(ap.textContent==\" \" || ap.textContent==\"&nbsp;\"){
ap.remove();
}
// SNIPPET:
String.prototype.contains
// SNIPPET:
if(!('contains' in String.prototype)) {
String.prototype.contains = function(str, startIndex) {
return -1 !== String.prototype.indexOf.call(this, str, startIndex);
}
}
// SNIPPET:
if(!String.prototype.contains) {
String.prototype.contains = function(str, startIndex) {
return this.indexOf(str, startIndex) !== -1;
}
}
// SNIPPET:
<div>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
...
</div>
// SNIPPET:
<li>
// SNIPPET:
Triangulate()
// SNIPPET:
ImageCalculation()
// SNIPPET:
img_mouse_down()
// SNIPPET:
function img_mouse_down(){
if(leftMouseButton){
Triangulate(); //Call this function every time.
ImageCalculation(); //Call this function only the last time
}
}
// SNIPPET:
Triangulate()
// SNIPPET:
ImageCalculation()
// SNIPPET:
mousemove
// SNIPPET:
$('#canvas').on('mousedown', function(){
going = !going;
$(this).on('mousemove', function(e){
if(cursor == 'paint' && going == true){
$('.fall').each(function(){
if ($(this).css(\"opacity\") == 0){
$(this).remove();
};
});
var ps = $('#canvas').offset().top;
var t = (e.pageY - ps - $('.fall').height()).toString() + 'px';
var l = (e.pageX - $('.fall').width()).toString() + 'px';
$('.fall').css(\"margin_left\",l);
$('.fall').css(\"margin_top\",t);
var doit = '<div class=\"fall\" style=\"position:absolute;margin-left:' + l + ';margin-top:' + t + ';background-color:'+ color +';box-shadow: 0px 0px 5px ' + color + ';\"></div>'
$('#canvas').prepend(doit);
}
else if(cursor == 'erase'){
$('.fall').mouseenter(function(){
$(this).fadeOut('fast',function(){
$(this).remove()
});
});
};
});
// SNIPPET:
mousemove
// SNIPPET:
atoms = [
['Na', [0, 0, 0]],
['Na', [0.5, 0.5, 0]],
['Na', [0.5, 0, 0.5]],
['Na', [0, 0.5, 0.5]],
['Cl', [0.5, 0, 0]],
['Cl', [0, 0.5, 0]],
['Cl', [0, 0, 0.5]],
['Cl', [0.5, 0.5, 0.5]],
];
// SNIPPET:
<a id=\"{{state}}\"></a>
<div>
<h4>{{dealer}} : {{city}}, {{state}} {{l_type}}</h4>
<div class=\"{{icon_class}}\">
<ul>
<li><i class=\"icon-map-marker\"></i></li>
<li><i class=\"icon-phone\"></i></li>
<li><i class=\"icon-print\"></i></li>
</ul>
</div>
<div class=\"listingInfo\">
<p>{{street}} <br>{{suite}}<br>
{{city}}, {{state}} {{zip}}<br>
Phone: {{phone}}<br>
{{toll_free}}<br>
{{fax}}
</p>
</div>
</div>
<hr>
// SNIPPET:
{ \"dealers\" : [
{
\"dealer\":\"Benco Dental\",
\"City\":\"Denver\",
\"state\":\"CO\",
\"zip\":\"80112\",
\"l_type\":\"Showroom\",
\"icon_class\":\"listingIcons_3la\",
\"phone\":\"(303) 790-1421\",
\"toll_free\":null,
\"fax\":\"(303) 790-1421\"
},
{
\"dealer\":\"Burkhardt Dental Supply\",
\"City\":\"Portland\",
\"state\":\"OR\",
\"zip\":\"97220\",
\"l_type\":\"Showroom\",
\"icon_class\":\"listingIcons\",
\"phone\":\" (503) 252-9777\",
\"toll_free\":\"(800) 367-3030\",
\"fax\":\"(866) 408-3488\"
}
]}
// SNIPPET:
ul
// SNIPPET:
ReferenceError: Joomla is not defined
// SNIPPET:
motool.js core.js
// SNIPPET:
<script src=\"\"></script>
// SNIPPET:
$.ajax({
url: \"https://api.parse.com/1/classes/chats\",
dataType: \"json\",
success: function(data) {
var stuff = [];
for(i=0; i < 10; i++) {
stuff[i] = data.results[i].text
}
// SNIPPET:
create:function(el,attr,sty_le){
this.elem=document.createElement(el);
for(var k in attr){
if(attr.hasOwnProperty(k)){
this.elem.setAttribute(k,attr[k]);
}
}
for(var k in sty_le){
if(sty_le.hasOwnProperty(k)){
this.elem.style[k]=sty_le[k];
}
}
return this.elem;
}
// SNIPPET:
this.elem.style[k]=sty_le[k];
// SNIPPET:
iframe
// SNIPPET:
e.preventDefault()
// SNIPPET:
return false
// SNIPPET:
<!DOCTYPE html>
<html lang=\"en-us\">
<head>
<title>Load</title>
<meta charset=\"utf-8\" />
<script src=\"http://code.jquery.com/jquery-1.9.1.js\"></script>
<script>
$(function() {
$(\"#run\").click(function(e) {
e.preventDefault();
var framex = document.getElementById('iframe');
framex.setAttribute(\"src\", \"local.html\");
framex.style.height = (framex.contentWindow.document.body.scrollHeight + 50) + \"px\";
return false;
});
});
</script>
</head>
<body>
<input id=\"run\" type=\"button\" value=\"Load\">
<div id=\"div\" style=\"width: 100%; height: 600px; overflow: auto;\">
<iframe id=\"iframe\" width=\"100%\" frameBorder=\"0\">
</iframe>
</div>
</body>
</html>
// SNIPPET:
// expressionFromServer example: 'x.foo < 3 && x.bar != 5'
var filteredRows =
$.grep(availableActivityRows, new Function('x', 'return ' +
expressionFromServer + ';'));
// SNIPPET:
for(var i=1; i <= 5; i++) {
var id = \"item\" + i;
var li = $(\"<li data-theme=\\\"d\\\" id=\\\"\" + id + \"\\\">Item \" + i + \"</li>\");
li.appendTo(ul);
$(document).delegate(\"#\"+id, \"tap\", function() {
$(\"#\"+id).attr({ \"data-theme\" : \"e\", \"class\" : \"ui-li ui-li-static ui-btn-up-e\" });
});
}
// SNIPPET:
pattern1 = [\"Clave 1\",[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],\"description\"];
pattern2 = [\"Clave 2\",[1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,0,1],\"description\"];
pattern3 = [\"Clave 3\",[1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1],\"description\"];
pattern4 = [\"Clave 4\",[1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0],\"description\"];
pattern5 = [\"Clave 5\",[1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1],\"description\"];
pattern6 = [\"Clave 6\",[1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0],\"description\"];
pattern7 = [\"Clave 7\",[1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1],\"description\"];
pattern8 = [\"Clave 8\",[1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0],\"description\"];
var pattern_collection = [pattern1, pattern2, pattern3, pattern4, pattern5, pattern7, pattern8];
function generate_buttons(instrument_id) {
for (var key in pattern_collection)
{
//creating an array of button for each instrument
var button = new Array();
//creating the button label
var button_text;
button_text = document.createTextNode(pattern_collection[key][0]);
//creating the button in the DOM
button[key] = document.createElement('div');
//by default, the first pattern is shown as playing
if (pattern_collection[key]==pattern1)
button[key].className = \"isplaying_pattern_button\";
else
button[key].className = \"notplaying_pattern_button\";
button[key].onclick = function() {
//picking the currently playing button to change its class to not playing
var playing_button = document.querySelector(\"#\"+instrument_id+\" .isplaying_pattern_button\");
playing_button.className = \"notplaying_pattern_button\";
//this is where the problem occurs: the script is always targeting the last button of the row
button[key].className = \"isplaying_pattern_button\";
};
button[key].appendChild(button_text);
var instrument_patterns = document.getElementById(instrument_id);
instrument_patterns.appendChild(button[key]);
}
}
// SNIPPET:
$('table#ratings input[name=newReviewRatings]')
// SNIPPET:
$.post()
// SNIPPET:
<form>
// SNIPPET:
$(\"#btn_contact\").click(function () {
$(\"#content_contact\").show();
$(\"#content_home\").hide();
$(\"#content_products\").hide();
$(\"#body_aux\").hide() ;
$(this).addClass('visited');
$('#btn_products').removeClass('visited');
$('#btn_home').removeClass('visited');
});
// SNIPPET:
<form id=\"frmEntityEdit\" enctype=\"multipart/form-data\" onsubmit=\"javascript:return
WebForm_OnSubmit();\" action=\"entityEditProducts.aspx?
EntityFilterID=239&EntityName=Category&iden=6751\" method=\"post\" name=\"frmEntityEdit\">
// SNIPPET:
<input id=\"TabStrip1_Data\" type=\"hidden\" name=\"TabStrip1_Data\">
<input id=\"TabStrip1_Properties\" type=\"hidden\" name=\"TabStrip1_Properties\">
<input id=\"TabStrip1_SelectedNode\" type=\"hidden\" value=\"p0\" name=\"TabStrip1_SelectedNode\">
<input id=\"TabStrip1_ScrollData\" type=\"hidden\" value=\"0\" name=\"TabStrip1_ScrollData\">
// SNIPPET:
<input tabIndex=\"0\" title=\"Please enter transaction amount.\" id=\"TR_Amount\" style=\"width: 425px;\" maxLength=\"10\" value=\"\"/>
<input name=\"TR_Amount\" type=\"hidden\" value=\"\"/>
<BR />
<input tabIndex=\"0\" title=\"\" class=\"InfoColor\" id=\"check_amt\" style=\"width: 141px;\" maxLength=\"30\" readOnly=\"\" value=\"\"/>
<input name=\"check_amt\" type=\"hidden\" value=\"\"/>
<BR />
<DIV>
<LABEL title=\"\" class=DefaultBold>Reserve Amount:
<LABEL tabIndex=-1 title=\"\" class=AttentionColor>#SAvlAmt#</LABEL>
</LABEL>
</DIV>
// SNIPPET:
function amtGreatRes(){
var ChkAmount = $('input[name=\"check_amt\"]').val(); // Works
var ReserveAmt = $('#AvlAmt').val(); // My confusion
if(ChkAmount > ReserveAmt){
jAlert('The payment amount entered exceeds the reserve amount for this transaction. Please correct payment amount.');
}else{jAlert('You did it!');}
}
// SNIPPET:
<form ng-submit=\"addTodo()\">
<span ng-repeat=\"t in todos[0].Collection.InputList\">
<label>{{t.DisplayName}}</label>
<input type=\"text\" name=\"{{t.FieldName}}\"><br>
</span>
<br>
<input class=\"btn-primary\" type=\"submit\" value=\"Add\">
</form>
// SNIPPET:
function TodoCtrl($scope) {
$scope.todos = [{
\"Header\": \"Chris Morgan\",
\"Collection\": {
\"InputList\": [{
\"FieldName\": \"dpFname\",
\"DisplayName\": \"First Name\",
\"Required\": \"1\",
\"AllowEdit\": \"1\",
\"TabOrder\": \"1\",
\"InputType\": \"TEXTBOX\",
\"Style\": \"\",
\"Validate\": \"\",
\"InputMask\": \"\",
\"Options\": [],
\"Value\": \"Chris\"
}, {
\"FieldName\": \"dpMname\",
\"DisplayName\": \"Middle Name\",
\"Required\": \"0\",
\"AllowEdit\": \"1\",
\"TabOrder\": \"2\",
\"InputType\": \"TEXTBOX\",
\"Style\": \"\",
\"Validate\": \"\",
\"InputMask\": \"\",
\"Options\": [],
\"Value\": \"\"
}, {
\"FieldName\": \"dpLname\",
\"DisplayName\": \"Last Name\",
\"Required\": \"1\",
\"AllowEdit\": \"1\",
\"TabOrder\": \"3\",
\"InputType\": \"TEXTBOX\",
\"Style\": \"\",
\"Validate\": \"\",
\"InputMask\": \"\",
\"Options\": [],
\"Value\": \"Morgan\"
}]
}
}];
$scope.addTodo = function () {
$scope.todos.push({
Header: $scope.dpFname + \" \" + $scope.dpLname,
Collection: {
\"InputList\": [{
\"FieldName\": \"dpFname\",
\"DisplayName\": \"First Name\",
\"Required\": \"1\",
\"AllowEdit\": \"1\",
\"TabOrder\": \"1\",
\"InputType\": \"TEXTBOX\",
\"Style\": \"\",
\"Validate\": \"\",
\"InputMask\": \"\",
\"Options\": [],
\"Value\": $scope.dpFname
}, {
\"FieldName\": \"dpLname\",
\"DisplayName\": \"Last Name\",
\"Required\": \"1\",
\"AllowEdit\": \"1\",
\"TabOrder\": \"3\",
\"InputType\": \"TEXTBOX\",
\"Style\": \"\",
\"Validate\": \"\",
\"InputMask\": \"\",
\"Options\": [],
\"Value\": $scope.dpLname
}, {
\"FieldName\": \"dpMname\",
\"DisplayName\": \"Middle Name\",
\"Required\": \"0\",
\"AllowEdit\": \"1\",
\"TabOrder\": \"2\",
\"InputType\": \"TEXTBOX\",
\"Style\": \"\",
\"Validate\": \"\",
\"InputMask\": \"\",
\"Options\": [],
\"Value\": $scope.dpMname
}
]
}
});
// Clear form fields
$scope.dpFname = '';
$scope.dpLname = '';
$scope.dpMname = '';
};
// SNIPPET:
// ==UserScript==
// @name TEDToYoutube
// @include http://www.ted.com/talks/*.html
// @exclude http://www.ted.com/talks/*.html?*
// @version 1
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
// @run-at document-start
// @grant none
// @namespace abiteasier.in
// ==/UserScript==
var url = window.location.href;
var talk_name = url.split(\"/\").pop();
talk_name = talk_name.substring(0, talk_name.lastIndexOf('.html'));
var youtube_search_url = 'http://www.youtube.com/user/TEDtalksDirector/search?query=' + talk_name;
window.location.href = youtube_search_url;
$(document).ready( function() {
alert(\"called\");
var a = $(\"li.channels-browse-content-list-item\");
alert(a.length());
} );
// SNIPPET:
smallImgs.length == true
// SNIPPET:
imgs
// SNIPPET:
ng-hide
// SNIPPET:
ng-show
// SNIPPET:
imgs
// SNIPPET:
smallImgs
// SNIPPET:
ng-hide
// SNIPPET:
$resource
// SNIPPET:
$scope.itemSearch.get({query:$routeParams.query, page:$routeParams.page}, function(data){
$scope.posts = data.posts;
for(var i = 0; i<$scope.posts.length; i++){
$scope.posts[i].imgs = testImgs($scope.posts[i]);
}
});
var testImgs = function(data){
if (data.smallImgs.length){
return data.smallImgs;
} else{
return data.imgs;
}
}
// SNIPPET:
#module-container
// SNIPPET:
.return-news
// SNIPPET:
#module-container
// SNIPPET:
var module = $('#module-container');
$('.menu-control').add(module).mouseenter(function() {
module.stop().show();
clearTimeout(window.mtimer);
console.log('hovered');
});
$('.menu-control').add(module).mouseleave(function() {
var time = 3000;
window.mtimer = setTimeout(function() {
module.fadeOut(600);
}, time);
console.log(window.mtimer);
});
// SNIPPET:
.return-news
// SNIPPET:
$('.return-news').on('click',function(e) {
e.stopPropagation();
module.add('.menu-control').off('mouseenter').off('mouseleave');
console.log('stop it!');
});
// SNIPPET:
.next-video
// SNIPPET:
$('.next-video').on('click',function(e) {
e.stopPropagation();
module.add('.menu-control').on('mouseenter').on('mouseleave');
});
// SNIPPET:
.next-video
// SNIPPET:
function callMe(array){
var s = \"\";
s += array; //<
// SNIPPET:
I want to access the array's member here, eg. array[0], array[1], ...
return s;
}
var myArr = [\"begin\", 1, 2, 3, 4, \"end\"];
console.log(callMe.apply(this, myArr));
// SNIPPET:
callMe.call(this, arg1, arg2, arg3)
// SNIPPET:
callMe.apply(this, [arg1, arg2, arg3])
// SNIPPET:
array[0] = \"yeah\";
array[1] = 200;
array[2] = 150;
array[3] = \"fine\";
// SNIPPET:
[\"begin\", 1, 2, 3, 4, \"end\"]
// SNIPPET:
Function.prototype.apply
// SNIPPET:
callMe.apply(this, arrayOfArguments)
// SNIPPET:
call()
// SNIPPET:
div
// SNIPPET:
div
// SNIPPET:
id
// SNIPPET:
<!DOCTYPE HTML>
<html>
<head>
<script src=\"check.js\"></script>
<style type=\"text/css\">
#div1 {
width:350px;
height:120px;
padding:10px;
margin-bottom:15px;
border:1px solid #aaaaaa;
}
.box {
display:inline;
width:100px;
height:30px;
padding:10px;
border:1px solid #aaaaaa;
}
</style>
<script>
function allowDrop(ev) {
ev.preventDefault();
}
function drag(ev) {
ev.dataTransfer.setData(\"Text\", ev.target.id);
}
function drop(ev) {
ev.preventDefault();
var data = ev.dataTransfer.getData(\"Text\");
ev.target.appendChild(document.getElementById(data));
}
</script>
</head>
<body>
<div id=\"div1\" ondrop=\"drop(event)\" ondragover=\"allowDrop(event)\"></div>
<div class=\"box\" id=\"foo\" draggable=\"true\" ondragstart=\"drag(event)\">foo </div>
<div class=\"box\" id=\"bar\" draggable=\"true\" ondragstart=\"drag(event)\">bar </div>
<input type=\"button\" name=\"check\" id=\"check\" value=\"Check\">
</body>
</html>
// SNIPPET:
window.onload = function () {
var button = document.getElementById('check');
button.addEventListener(\"click\", handler, false);
function handler() {
var d = document.getElementById(\"div1\");
var children = d.childNodes;
//var children = d.children; tried both children and childNode : works in FF/Chrome not IE
var i;
document.write(children.length + \"<br>\");
document.write(children[0] + \"<br>\");
document.write(children[1] + \"<br>\");
for (i = 0; i < children.length; i++) {
document.write(children[i].id);
}
}
}
// SNIPPET:
2
[object HTMLDivElement]
[object HTMLDivElement]
foobar
// SNIPPET:
2
undefined
undefined
// SNIPPET:
div
// SNIPPET:
.children
// SNIPPET:
.childNode
// SNIPPET:
appendChild
// SNIPPET:
$(document).ready(function () {
$('#druckerdetails').dataTable({
\"bPaginate\": false,
\"bLengthChange\": false,
\"bFilter\": false,
\"bSort\": false,
\"bInfo\": false,
\"bAutoWidth\": false,
\"bProcessing\": true,
\"bServerSide\": false,
\"sAjaxSource\": 'php/index_druckerdetails.php?druckername=RAGPLM002'
});
$(function () {
var table = $('#druckerdetails');
alert('Besten Dank, dass Sie isyPrint benutzen :)');
table.find('thead tr').detach().prependTo(table.find('tbody'));
var t = table.find('tbody').eq(0);
var r = t.find('tr');
var cols = r.length;
var rows = r.eq(0).find('td,th').length;
var cell, next, tem, i = 0;
var tb = $('<tbody></tbody>');
while (i < rows) {
cell = 0;
tem = $('<tr></tr>');
while (cell < cols) {
next = r.eq(cell++).find('td,th').eq(0);
tem.append(next);
}
tb.append(tem);
++i;
}
table.find('tbody').remove();
$(tb).appendTo(table);
$(table)
.find('tbody tr:eq(0)')
.detach()
.appendTo(table.find('thead'))
.children();
table.show();
});
});
// SNIPPET:
<select>
<option>page1 id|AccessToken></option>
<option>page2 id|AccessToken></option>
<option>page3 id|AccessToken></option>
</select>
// SNIPPET:
function submitPost()}{
$('#users input:checkbox').each(function () {
var a = (this.checked ? $(this).val() : \"\");
if (a != \"\"){
postToPage(a) // a = PageId|AccessToken <option>PageId|AccessToken</option>
}
});
}
function postToPage(c) {
dataSeprator = c.split(\"|\");
d = dataSeprator[0];
my_message = $('#txtmsg').val();
url = $('#txturl').val();
title = $('#txttitle').val();
desc = $('#txtdesc').val();
picUrl = 'facebook.png';
FB.api('/' + d, { fields: 'access_token'}, function (b) {
if (dataSeprator[1].length > 0) {
FB.api('/' + d + '/feed', 'post', {
message: my_message,
link: url,
name: title,
picture: picUrl,
description: desc,
access_token: dataSeprator[1]
}, function (a) {
if (!a || a.error) {
alert('Error occured')
} else {
alert('Message Posted Successfully.')
}
})
}
})
}
// SNIPPET:
<!DOCTYPE html>
<html>
<head>
<script src=\"http://code.jquery.com/jquery-1.7.2.min.js\"></script>
<script type=\"text/javascript\">
var streamRecorder;
var webcamstream;
function enter()
{
if (navigator.mozGetUserMedia) {
navigator.myGetMedia=navigator.mozGetUserMedia;
navigator.myGetMedia({video: true}, connect, error);
}
else {
alert(\"N\");
}
function connect(stream)
{
var video = document.getElementById(\"my_video\");
video.src = window.URL ? window.URL.createObjectURL(stream) : stream;
webcamstream = stream;
video.play();
}
function error(e) { console.log(e); }
}
function startRecording()
{
alert('STARTING');
streamRecorder = webcamstream.record();
setTimeout(stopRecording, 10000);
}
function stopRecording()
{
alert('STOP');
streamRecorder.getRecordedData(postVideoToServer);
}
function postVideoToServer(videoblob) {
alert ('start video uploaded');
var data = {};
data.video = videoblob;
data.metadata = 'test metadata';
data.action = \"upload_video\";
jQuery.post(\"http://www.kongraju.in/uploadvideo.php\", data, onUploadSuccess);
}
function onUploadSuccess() {
alert ('video uploaded');
}
</script>
<title>Untitled Document</title>
</head>
<body>
<canvas width=\"640\" height=\"480\" id=\"c\"></canvas>
<input type=\"button\" value=\"START CAMERA\" onClick=\"enter()\"/>
<input type=\"button\" value=\"START RECORD\" onClick=\"startRecording()\"/>
<input type=\"button\" value=\"STOP RECORD\" onClick=\"stopRecording()\"/>
<video id=\"my_video\" width=\"640\" height=\"480\"/>
</body>
</html>
// SNIPPET:
%table
- @schedules.each do |s|
%tr
%td= best_in_place s, :name
$(document).ready(function() {
/* Activating Best In Place */
jQuery(\".best_in_place\").best_in_place();
});
// SNIPPET:
Uncaught TypeError: Object [object Object] has no method 'best_in_place'
// SNIPPET:
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html lang=\"EN\" dir=\"ltr\" xmlns=\"http://www/w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"content-type\"
content=\"text/xml; charset=utf-8\" />
<title>change2.html</title>
<script type = \"text/javascript\"
src = \"jquery-1.4.2.min.js\">
</script>
<script type = \"text/javascript\">
//<![CDATA[
$(document).ready(changeMe);
function changeMe(){
$(\"#output\").html(\"I've changed\");
}
//]]>
</script>
</head>
<body>
<h1>Using the document.ready mechanism</h1>
<div id = \"output\">
Did this change?
</div>
</body>
</html>
// SNIPPET:
<a href=\"javascript:...()\">
// SNIPPET:
href=\"#\"
// SNIPPET:
var tim = new Date();
function loadLog(){
document.getElementById('timebox').innerHTML=tim.getTime();
}
window.setInterval(loadLog, 1000);
// SNIPPET:
a(this).bind(\"rfuSelect\", { action: settings.onSelect }, function (j, h, i) {
if (j.data.action(j, h, i) !== false) {
var k = Math.round(i.size / 1024 * 100) * 0.01;
alert(k.toString())
var l = \"KB\";
}
});
// SNIPPET:
$scope.connect = function(url) {
var defer = $q.defer();
var promise = $http.get(url).then(function (response) {
$timeout(function(){
defer.resolve(response);
},10000);
defer.resolve(response);
$scope.$apply(); //$rootScope.$apply();
});
return defer.promise;
};
$scope.mymethod = function(){
$scope.globalMydata[];
console.log(\"before the http get\");
$scope.connect(\"MY_URL\").then(function(data) {
console.log(\"called!\", data);
console.log(\"INSIDE the http get\");
$scope.mydata = data;
//$scope.globalMydata.push(data);
});
console.log(\"after the http get \");
//do some processing of the returned data here
var dataHolder = $scope.mydata;
return calculatedValue;//value from procesing
}
// SNIPPET:
var testURL = \"/test/data\",
testData = { a: 1, b: \"c\" };
asyncTest(\"AJAX response test\", 1, function() {
$.mockjax({
url: testURL,
responseText : JSON.stringify(testData)
});
$.ajax({
url: testURL,
dataType: \"json\",
success: function(data) {
deepEqual(data, testData, 'AJAX response is OK');
},
complete: function() {
start();
}
});
$.mockjaxClear();
});
// SNIPPET:
* $.mockjaxClear()
Removes all mockjax handlers.
// SNIPPET:
mockjaxClear
// SNIPPET:
$.ajax()
// SNIPPET:
complete
// SNIPPET:
$.ajax()
// SNIPPET:
var container = Ext.create(\"Ext.container.Container\", {
renderTo: Ext.getBody(),
layout: {
type: \"vbox\"
}
});
var fieldset = Ext.create(\"Ext.form.FieldSet\", {
renderTo: \"fieldset\"
});
var text = Ext.create(\"Ext.form.field.Text\", {
renderTo: \"text\"
});
var button = Ext.create(\"Ext.Button\", {
renderTo: \"button\",
text: \"My Button\"
});
fieldset.add(text);
fieldset.add(button);
container.add(fieldset);
// SNIPPET:
Ext.apply(fieldset,{collapsible:true,style:\"bakground:red\"});
// SNIPPET:
Msg = Backbone.Model.extend({
validate: function(attr){
if(attr.msg === undefined || attr.msg === ''){
return \"empty messege\";
}
},
initialize: function(){
this.on('invalid',function(model,error){
console.log(error);
});
}
});
// SNIPPET:
msgCollection.create({msg:''});
// SNIPPET:
function reflashIPCam(){
newImage = new Image();
newImage.src = \"image taken from the camera\" + new Date().getTime();
document.getElementById(\"IPCamIMG\").src = newImage.src;
}
function playIPCamLoop(){
for (var i=0;i<5;i++){
delayFunction();
}
}
function delayFunction(){
setTimeout(reflashIPCam, 1000);
}
// SNIPPET:
@Path(\"parent\")
public class ParentResource {
@GET
@Produces ({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Parent generateExample(){
Parent father = new Parent();
father.setName(\"peter\");
Child john = new Child();
john.setName(\"john\");
father.getChildren().add(john);
return father;
}
@GET
@Path(\"list\")
@Produces ({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Parent generateExample2(){
Parent father = new Parent();
father.setName(\"peter\");
Child john = new Child();
john.setName(\"john\");
Child sue = new Child();
sue.setName(\"sue\");
father.getChildren().add(john);
father.getChildren().add(sue);
return father;
}
@POST
@Produces ({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Consumes ({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Parent echoEntity(Parent input){
return input;
}
}
// SNIPPET:
@XmlAccessorType (XmlAccessType.NONE)
@XmlRootElement (name=\"parent\")
public class Parent implements Serializable{
@XmlAttribute
private String name;
@XmlElement
private List<Child> children = null;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Child> getChildren() {
if(children == null){
children = new LinkedList<Child>();
}
return children;
}
public void setChildren(List<Child> children) {
this.children = children;
}
// SNIPPET:
@XmlAccessorType (XmlAccessType.NONE)
@XmlRootElement (name=\"child\")
public class Child implements Serializable {
@XmlElement
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
// SNIPPET:
@javax.xml.bind.annotation.XmlSchema(namespace=\"http://myexample.com\",
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED,
attributeFormDefault = javax.xml.bind.annotation.XmlNsForm.UNQUALIFIED)
// SNIPPET:
@Provider
@Produces (MediaType.APPLICATION_JSON)
@Consumes (MediaType.APPLICATION_JSON)
public class CustomResolver implements ContextResolver<JAXBContext>{
private final JAXBContext context;
private final Set<Class<?>> types;
private final Class<?>[] cTypes = {
Parent.class, Child.class
};
public CustomResolver() throws Exception {
this.types = new HashSet<Class<?>>(Arrays.asList(cTypes));
Map<String, String> nsMap = new HashMap<String, String>();
nsMap.put(\"http://myexample.com\", \"ex\");
JSONConfiguration config = JSONConfiguration.natural().rootUnwrapping(false).build();
// JSONConfiguration config = JSONConfiguration.mapped().xml2JsonNs(nsMap).attributeAsElement(\"name\").rootUnwrapping(false).build();
// JSONConfiguration config = JSONConfiguration.mapped().attributeAsElement(\"name\").rootUnwrapping(false).build();
// JSONConfiguration config = JSONConfiguration.mappedJettison().build();
// JSONConfiguration config = JSONConfiguration.badgerFish().build();
context = new JSONJAXBContext(config, cTypes);
}
public JAXBContext getContext(Class<?> objectType) {
return (types.contains(objectType)) ? context : null;
}
}
// SNIPPET:
public class RestApplication extends Application {
private Set<Object> singletons = new HashSet<Object>();
private Set<Class<?>> classes = new HashSet<Class<?>>();
public RestApplication(){
singletons.add(new ParentResource());
classes.add(CustomResolver.class);
}
@Override
public Set<Class<?>> getClasses(){
return classes;
}
@Override
public Set<Object> getSingletons(){
return singletons;
}
}
// SNIPPET:
generated 1 :
{\"@name\":\"peter\",\"children\":{\"name\":\"john\"}}
output of post method :
{\"@name\":\"peter\"}
generated 2 :
{\"@name\":\"peter\",\"children\":[{\"name\":\"john\"},{\"name\":\"sue\"}]}
output of post method :
{\"@name\":\"peter\"}
// SNIPPET:
generated 1 :
{\"parent\":{\"name\":\"peter\",\"children\":[{\"name\":\"john\"}]}}
output of post method :
Exception: The request sent by the client was syntactically incorrect ()
generated 2 :
{\"parent\":{\"name\":\"peter\",\"children\":[{\"name\":\"john\"},{\"name\":\"sue\"}]}}
output of post method :
Exception: The request sent by the client was syntactically incorrect ()
// SNIPPET:
generated 1 :
{\"parent\":{\"name\":\"peter\",\"children\":{\"name\":\"john\"}}}
output of post method :
The request sent by the client was syntactically incorrect ()
generated 2 :
{\"parent\":{\"name\":\"peter\",\"children\":[{\"name\":\"john\"},{\"name\":\"sue\"}]}}
output of post method :
The request sent by the client was syntactically incorrect ()
// SNIPPET:
generated 1 :
{\"ex.parent\":{\"name\":\"peter\",\"ex.children\":{\"ex.name\":\"john\"}}}
output of post method :
{\"ex.parent\":{\"name\":\"peter\",\"ex.children\":{\"ex.name\":\"john\"}}}
generated 2 :
{\"ex.parent\":{\"name\":\"peter\",\"ex.children\":[{\"ex.name\":\"john\"},{\"ex.name\":\"sue\"}]}}
output of post method :
{\"ex.parent\":{\"name\":\"peter\",\"ex.children\":[{\"ex.name\":\"john\"},{\"ex.name\":\"sue\"}]}}
// SNIPPET:
<html><head>
<script type=\"text/javascript\">
<!--
var divobject = null;
function init(id){
divobject = document.getElementById('id');
divobject.style.left = '25px';
divobject.style.top = '580px';
divobject.style.visibility = 'hidden';
}
function moveUp(id){
divobject = document.getElementById(id);
divobject.style.visibility = 'visible';
divobject.style.left = '25px';
divobject.style.top = parseInt(div.style.top) + 0 + 'px';
divobject.style.position = 'absolute';
}
document.onclick =init;
window.onload =init;
//-->
</script>
</head>
<body>
<a href=\"javascript:void(moveup('1'));\">show div</a>
<div id=\"1\">tytt</div>
</body>
// SNIPPET:
client.books.volumes.list({q: query}).withAuthClient(oath2Client);
// SNIPPET:
var reader = new FileReader();
var blob = file.slice(start, end);
reader.readAsBinaryString(blob);
// SNIPPET:
event.target.result.slice(event.target.result.indexOf(\"stringA\"), event.target.result.indexOf(\"stringB\"))
// SNIPPET:
<tr data-ng-repeat=\"item in pagedItems\">
<td title={{item.name}}>{{item.name}}</td>
<td> <input type=text auto-complete ng-model=\"item.upload_status\">
Upload status: {{item.upload_status}}</td>
<td title={{item.lat}}>{{item.lat}}</td>
<td title={{item.lon}}>{{item.lon}}</td>
</tr>
// SNIPPET:
myapp.directive('autoComplete', function(autoCompleteDataService) {
return {
restrict: 'A',
link: function(scope, elem, attr, ctrl) {
elem.autocomplete({
source: autoCompleteDataService.getSource(),
select: function( event, ui ) {
scope.$apply(function() { this.item.upload_status = ui.item.value; });
},
change: function (event, ui) {
if (ui.item === null) {
scope.$apply(function() { scope.foo = null });
}
},
minLength: 2
});
}
};
// SNIPPET:
Uncaught SyntaxError: Unexpected string
// SNIPPET:
$(function(){
$(\"#type\").change(function() {
var tval = document.getElementById('type').value;
$(\"#source\").load(encodeURI(\"findbackend.php?type=\" + tval));
});
$(\"#source\").change(function() {
sval = document.getElementById('source').value;
$(\"#range\").load(encodeURI(\"findbackend.php?source=\" + sval));
});
$(\"#range\").change(function() {
rval = document.getElementById('range').value;
$(\"#setpoint\").load(encodeURI(\"findbackend.php?range=\" + rval));
});
$(\"#setpoint\").change(function() {
stval = document.getElementById('setpoint').value;
$(\"#dig_num\").load(encodeURI(\"findbackend.php?range=\" + rval + \"&setpoint=\" + stval));
});
});
// SNIPPET:
$(function(){
$(\"#type\").change(function() {
var tval = document.getElementById('type').value;
$(\"#source\").load(encodeURI(\"findbackend.php?type=\" + tval));
});
$(\"#source\").change(function() {
sval = document.getElementById('source').value;
$(\"#range\").load(encodeURI(\"findbackend.php?source=\" + sval));
});
$(\"#range\").change(function() {
rval = document.getElementById('range').value;
$(\"#setpoint\").load(encodeURI(\"findbackend.php?range=\" + rval));
});
$(\"#setpoint\").change(function() {
stval = document.getElementById('setpoint').value;
$(\"#dig_num\").load(encodeURI(\"findbackend.php?range=\" + rval + \"&setpoint=\" + stval));
});
$(\"#dig_num\").change(function() {
dnum = document.getElementById('dig_num').value;
$(\"#findresults\").load(encodeURI(\"findbackend.php?range=\" + rval + \"&setpoint=\" + stval \"&dig_num=\" + dnum));
});
});
// SNIPPET:
npm install async
// SNIPPET:
npm install spotify-node-applescript
// SNIPPET:
Line 1. Char 1. Object expected. Error 800A138F
// SNIPPET:
<!-- background change -->
<script type=\"text/javascript\">
$(document).ready(function() {
$('#hoverarea').hover(function() {
$('body').addClass('hover');
}, function(){
$('body').removeClass('hover');
});
});
</script>
<!-- background change-->
<div id=\"hoverarea\"><a href=\"comingsoon.html\"> <img src=\"images/blank.png\" onmouseover=\"playSound('audio/apple2.mp3');\"> </a></div>
body {
background-image:url('../images/blackandwhite.gif');
background-position:50% 20px;
background-attachment:fixed;
background-repeat: no-repeat;
background-color:black;
height:714px;
width:1024;
}
#hoverarea {
position:absolute;
width:400px;
height:400px;
top:300px;
right:20px;
z-index:2000;
}
.hover {
background-image:url('../images/colour.gif');
}
li a:hover + img {
left: 0px;
}
// SNIPPET:
<script language=\"javascript\" src=\"http://example.org/jdcheck.js\"></script>
<script language=\"javascript\" src=\"popup.js\"></script>
// SNIPPET:
if (variable) { [...] }
// SNIPPET:
background.$(document).ready(function() {
var jq = document.createElement('script'); jq.type = 'text/javascript';
jq.src = 'http://127.0.0.1:9666/jdcheck.js';
document.getElementsByTagName('head')[0].appendChild(jq);
if(jdownloader){
[...action]
}
});
// SNIPPET:
Uncaught ReferenceError: jdownloader is not defined
// SNIPPET:
function keepGoing() {
console.log(\"JS should have been loaded\");
if(jdownloader){
[action]
}
}
var jq = document.createElement('script');
jq.onload = keepGoing();
jq.src = 'http://127.0.0.1:9666/jdcheck.js';
document.getElementsByTagName('head')[0].appendChild(jq);
// SNIPPET:
JS should have been loaded popup.js:98
Uncaught ReferenceError: jdownloader is not defined popup.js:100
// SNIPPET:
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>Untitled Document</title>
<base href=\"http://localhost/test/\" />
<script src=\"jQuery.js\"></script>
<script>
$(document).ready(function(){
$(\"#text-search\").keyup(function(e){
if (e.keyCode == 13){
window.location.replace(\"testing/\"+$('#text-search').val());
}
})
})
</script>
</head>
<body>
<input type='text' id='text-search'>
</body>
</html>
// SNIPPET:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^testing/(.+)$ /test/testing.php?string=$1 [L]
// SNIPPET:
<section class=\"tabs\"> <input id=\"tab-1\" name=\"radio-set\" class=\"tab-selector-1\"
checked=\"checked\" type=\"radio\"> <label for=\"tab-1\" class=\"tab-label-1\">About</label>
<input id=\"tab-2\" name=\"radio-set\" class=\"tab-selector-2\" type=\"radio\"> <label
for=\"tab-2\" class=\"tab-label-2\">Services</label> <input id=\"tab-3\" name=\"radio-set\"
class=\"tab-selector-3\" type=\"radio\"> <label for=\"tab-3\" class=\"tab-label-3\">Work</label>
<input id=\"tab-4\" name=\"radio-set\" class=\"tab-selector-4\" type=\"radio\"> <label
for=\"tab-4\" class=\"tab-label-4\">Contact</label>
<div class=\"clear-shadow\"></div>
<div class=\"content\">
<div class=\"content-1\">
<h2>About us</h2>
<p>Hover over me!</p>
<h3>How we work</h3>
<p>Info </p>
</div>
<div class=\"content-2\">
<h2>Services</h2>
<p>Info</p>
<h3>Excellence</h3>
<p>Info </p>
</div>
<div class=\"content-3\">
<h2>Portfolio</h2>
<p>Info</p>
<h3>Examples</h3>
<p>Info </p>
</div>
<div class=\"content-4\">
<h2>Contact</h2>
<p>Info</p>
<h3>Get in touch</h3>
<p>Some Info </p>
</div>
</div>
</section>
// SNIPPET:
<div class=\"span6 mb-20\">
<h2 class=\"element-title\">Toggle</h2>
<ul id=\"toggle-view\">
<li class=\"clearfix\">
<h3>blah</h3>
<span>+</span>
<div class=\"clear\"></div>
<div class=\"panel clearfix\">
<p>Lorem ipsum </p>
</div>
</li>
<li class=\"clearfix\"> <span>+</span>
<h3>The Best Solution For Your Business</h3>
<div class=\"clear\"></div>
<div class=\"panel clearfix\">
<p>Lorem ipsum </p>
</div>
</li>
<li class=\"clearfix\"> <span>+</span>
<h3>Blah</h3>
<div class=\"clear\"></div>
<div class=\"panel clearfix\">
<p>Lorem ipsum </p>
</div>
</li>
</ul>
<!--end:toggle-view--> </div>
<!--span6--> </div>
// SNIPPET:
<div class=\"content-1\">
<h2>About us</h2>
<p>info</p>
<h3>How we work</h3>
<p>info</p>
</div>
<script>
$('p').hover(function(){
$('div').toggle();
}, function(){
$('div').toggle();
});
</script>
<div class=\"span6 mb-20\">
<h2 class=\"element-title\">Toggle</h2>
<ul id=\"toggle-view\">
<li class=\"clearfix\">
<h3>blah</h3>
<span>+</span>
<div class=\"clear\"></div>
<div class=\"panel clearfix\">
<p>Lorem ipsum </p>
</div>
</li>
<li class=\"clearfix\"> <span>+</span>
<h3>The Best Solution For Your Business</h3>
<div class=\"clear\"></div>
<div class=\"panel clearfix\">
<p>Lorem ipsum </p>
</div>
</li>
<li class=\"clearfix\"> <span>+</span>
<h3>Blah</h3>
<div class=\"clear\"></div>
<div class=\"panel clearfix\">
<p>Lorem ipsum </p>
</div>
</li>
</ul>
<!--end:toggle-view--> </div>
<!--span6--> </div>
// SNIPPET:
├── index.html
├── static
│ └── js
│ ├── main.js
│ ├── jquery.js
│ └── require.js
└── subfolder
└── index.html
// SNIPPET:
index.html
// SNIPPET:
<script data-main=\"static/js/main\" src=\"static/js/require.min.js\"></script>
// SNIPPET:
subfolder/index.html
// SNIPPET:
<script data-main=\"../static/js/main\" src=\"../static/js/require.min.js\"></script>
// SNIPPET:
main
// SNIPPET:
baseUrl
// SNIPPET:
static/js
// SNIPPET:
require.config({
baseUrl: 'static/js',
paths: {
'jquery': 'jquery-2.0.3',
}
});
require(['jquery'], function($) { ... }
// SNIPPET:
var moe = {name: 'moe', luckyNumbers: [13, 27, 34]};
var clone = {name: 'moe', luckyNumbers: [13, 27, 34]};
moe == clone;
=> false
// SNIPPET:
(function() {
console.log(\"writting dataaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\");
window.onMessage1 = function(messageEvent) {
console.log(\"writting dataaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\");
console.log(messageEvent.data[\"color\"]);
return $(\"form#credit-info-form\").append(messageEvent.data[\"color\"]);
};
}).call(this);
// SNIPPET:
HTML
<div id=\"textInput\"/>
<div id=\"btnContainer\"/>
CSS
#btnContainer{
height:44px;
display: none;
}
JS
$('#textInput').append(
$('<input>').addClass('ui-input-note').attr('placeholder', 'Notes')
);
$('#btnContainer').append(
$('<button id=\"submitBtn\" data-role=\"button\" data-inline=\"true\" data-mini=\"false\" data-theme=\"b\">Save Note</button>')
);
$('.ui-input-note').focus(function() {
$( \"#btnContainer\" ).slideDown({
duration: 500 ,
easing: 'jswing'
});
});
// SNIPPET:
$('.ui-input-note').focus(function() {
$( \"#btnContainer\" ).animate({
display: 'block',
left:'250px',
opacity:'0.5',
height:'150px',
width:'150px'
});
});
// SNIPPET:
<?php
echo json_encode(array(\"error\", 0, \"Success!\"));
?>
// SNIPPET:
$.ajax({
type: \"POST\",
url: \"../api/login.php\",
data: { id: username, password: password },
success: function(response) {
alert( \"Data Saved: \" + response );
$(\"#login_username\").val(\"\");
$(\"#login_password\").val(\"\");
}
});
// SNIPPET:
response
> \"[\"error\",0,\"Success!\"]\"
response[0]
> \"[\"
// SNIPPET:
2013-10-08 22:58:38 [INFO] [more info] Description or command
// SNIPPET:
2013-10-08 22:58:38 | [INFO] [more info] Description or command
// SNIPPET:
<div class=\"console-line\"><span class=\"Datetime\">2013-10-08 22:58:38</span>[INFO] [more info] Description or command</div
// SNIPPET:
$scope.dataset = [
metric: 'advocacy',
amount: 1
},
{
metric: 'appreciation',
amount: 8
},
{
metric: 'awareness',
amount: 1
}
];
arcs = arcs.data(pie($scope.dataset));
arcs.transition().duration(500);
// SNIPPET:
<a href=\"#\" id=\"new\" rel=\"create\">new</a><br>
<a href=\"#\" id=\"another\" rel=\"create\">another</a><br>
<input id=\"thisButton\" type=\"button\" name=\"Display\" value=\"Edit HTML Below then Click to Display\"/>
<iframe id=\"iframetest\" src=\"\" style=\"background: White;\"></iframe>
// SNIPPET:
var counter = {};
var myHTML = {
'new': '<input id=\"test%n\" name=\"test\" value=\"<b>blah</b> blah blah %n\">',
'another': '<input id=\"another%n\" name=\"test\" value=\"<b>cool</b> COOL! %n\">'
};
var htmlForId = {
'foo': ['a','b','c'],
'bar': ['d','e','f']
}
var createEls = document.querySelectorAll('a[rel=create]');
for(var i = 0; i < createEls.length; i++) {
createEls[i].onclick = create;
}
function create() {
var id = this.id;
var div = document.createElement('div');
div.className = 'create';
if (counter[id]===undefined) { counter[id] = 1; }
var thecurrentid = counter[id];
div.id = id + counter[id]++;
if (div.id in myHTML) {
div.innerHTML = myHTML[div.id].replace(/%n/g, thecurrentid);
} else if (this.id in myHTML) {
div.innerHTML = myHTML[this.id].replace(/%n/g, thecurrentid);
} else {
div.innerHTML = div.id;
}
document.body.appendChild(div);
return false;
}
var myArray = [
'b<strong>l</strong>a bla bla', // index 0
'foo', // index 1
'test' // index 2
];
function appendArray(a) {
for(var i = 0; i < a.length; i++) {
var div = document.createElement('div');
div.className = 'loop';
div.innerHTML = a[i];
document.body.appendChild(div);
}
}
// SNIPPET:
if((str.charAt(i) != '\\n') && (i!=(len-1)))
{
TChars = TChars + 1;
}
else
{
if(TChars >= 71)
{
Tres = Tres + Lno + \", \";
}
TChars = 0;
Lno = Lno + 1;
} if(Tres.length < 1)
Tres = \"No \";
document.AsciiConvert.HTMLResults.value += Tres + \"line number have more than 70 characters.\\n\";
// SNIPPET:
if(id == 'EX&219'){
//do someting
}
// SNIPPET:
c_menu
// SNIPPET:
menu_open
// SNIPPET:
menu_close
// SNIPPET:
menu_close
// SNIPPET:
<style type = \"text/css\">
#c_menu {
position: absolute;
width: 435px;
height: 250px;
z-index: 2;
left: 6px;
top: 294px;
background-color: #0099CC;
margin: auto;
</style>
// SNIPPET:
<div id=\"menu_open\"><img src=\"images/open.jpg\" width=\"200\" height=\"88\" /></div>
<input type=\"button\" name=\"menu_close\" id=\"menu_close\" value=\"Close\"/>
<div id=\"c_menu\"></div>
// SNIPPET:
<script type = \"text/javascript\" src = \"menu.js\"> </script>
// SNIPPET:
document.getElementById(\"c_menu\").style.height = \"0px\";
document.getElementById(\"menu_open\").onclick = menu_view(true);
document.getElementById(\"menu_close\").onclick = menu_view(false);
function menu_view(toggle)
{
if(toggle == true)
{
document.getElementById(\"c_menu\").style.height = \"0px\";
changeheight(5, 250, 0);
}
if(toggle == false)
{
document.getElementById(\"c_menu\").height = \"250px\";
changeheight(-5, 0, 250);
}
}
function changeheight(incr, maxheight, init)
{
setTimeout(function () {
var total = init;
total += incr;
var h = total + \"px\";
document.getElementById(\"c_menu\").style.height = h;
if (total != maxheight) {
changeheight(incr, maxheight, total);
}
}, 5)
}
// SNIPPET:
<form method=\"post\" onsubmit=\"return submitForm()\" id=\"myForm\" data-ajax=\"false\">
<lable for=\"title\" class=\"ui-hidden-accessible\">Title</lable><input type=\"text\" name=\"title\" placeholder=\"Title\"><br>
<button onclick=\"capturePhoto()\">Camera</button><br>
<input type=\"text\" name=\"description\" placeholder=\"description\">
<input type=\"submit\" value=\"submit\">
</form>
// SNIPPET:
addShortcut
// SNIPPET:
setup()
// SNIPPET:
setup : function(editor)
{
editor.addShortcut('ctrl+k', 'Show Link Window', 'some_command_goes_here');
},
// SNIPPET:
Uncaptioned
// SNIPPET:
onmousedown
// SNIPPET:
onmousedown
// SNIPPET:
<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
<html>
<head>
<link style=\"text/css\" rel=\"stylesheet\" href=\"../ptwebsite.css\" >
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">
<script>
function toggleCaption(picture)
{
var pic = document.getElementById(\"bodyPartPic\");
pic.src = picture;
}
</script>
<title>Name The Body Part</title>
</head>
<body onmousedown=\"toggleCaption('images/Wk 1_1_Spine_of_Scapula_uncaptioned.jpg')\">
<div class=\"maincontent\">
<ul id=\"navbar\">
<li><a href=\"../main.html\">Return to Main</a></li>
<li><a href=\"bodypart1002.php\">Next</a></li>
</ul>
<h1 id=\"welcomebanner\">Can You Name The Body Part?</h1>
<h3>Roll your mouse over the image to see the name</h3>
<img id=\"bodyPartPic\" class=\"portraitImage\"
src=\"images/Wk 1_1_Spine_of_Scapula_uncaptioned.jpg\"
onmouseover=\"toggleCaption('images/Wk 1_1_Spine_of_Scapula_captioned.jpg')\"
onmouseout=\"toggleCaption('images/Wk 1_1_Spine_of_Scapula_uncaptioned.jpg')\"
onmousedown=\"toggleCaption('images/Wk 1_1_Spine_of_Scapula_captioned.jpg')\"
/>
</div>
</body>
</html>
// SNIPPET:
<input style=\"width: 99%\" type=\"submit\" onclick=\"setTimeout(alert('hello'), 10000);\" value=\"Update and Close\" />
// SNIPPET:
XMLHttpRequest
// SNIPPET:
onprogress
// SNIPPET:
onload
// SNIPPET:
500 Internal Server Error
// SNIPPET:
xhr.onload
// SNIPPET:
xhr.onerror
// SNIPPET:
myobj = {
a: 'a',
a1: 'a1',
a2: 'a2',
a2a: 'a2a',
a2b: 'a2b',
a3: 'a3',
a3a: 'a3a',
a3a1: 'a3a1',
a3a2: 'a3a2',
b: 'b',
// ...
};
// SNIPPET:
myobj = {
a: {
a1: 'a1',
a2: {
a2a: 'a2a',
a2b: 'a2b'
},
a3: {
a3a: {
a3a1: 'a3a1',
a3a2: 'a3a2'
}
}
},
b: { ... }
};
// SNIPPET:
eventHandler: {
triggerObj: triggerObj,
triggerAction: triggerObj.someMethod,
responseObj: responseObj,
responseAction: responseObj.someMethod
}
// SNIPPET:
eventHandler: {
trigger: {
obj: triggerObj,
action: triggerObj.someMethod
},
response: {
obj: responseObj,
action: responseObj.someMethod
}
}
// SNIPPET:
fadeIn
// SNIPPET:
FadeOut
// SNIPPET:
`carousel-inner > .item {
display: none;
position: relative;
-webkit-transition: 0.6s ease-in-out left;
-moz-transition: 0.6s ease-in-out left;
-o-transition: 0.6s ease-in-out left;
transition: 0.6s ease-in-out left;`
}
// SNIPPET:
@-webkit-keyframes carousel-inner {
0%{
opacity: 0;
}
100%{
opacity: 1;
}
}
@keyframes carousel-inner{
0%{
opacity: 0;
}
100%{
opacity: 1;
}
}
.carousel-inner > .item {
display: none;
position: relative;
-webkit-transition: opacity 0.4s ease-in-out;
-moz-transition: opacity 0.4s ease-in-out;
-o-transition: opacity 2s ease-in-out;
transition: opacity 0.4s ease-in-out;
}
// SNIPPET:
var cboDetailsCategory = $(\"#detail\").kendoDropDownList({
data: [
\"All\",
\"Customer\",
\"Location\",
\"Meter\",
\"Other\"],
select: function (e) {
var template = $(\"#\" + e.item.text()).html();
console.log(\"template\", template);
$(\"#details\").html(template);
},
change: function (e) {
},
// SNIPPET:
app.postsCollection = new Posts.Collection();
// SNIPPET:
app.postsCollection.fetch( { success: ..., error: ... } );
// SNIPPET:
define( function( require, exports, module ) {
\"use strict\";
var app = require( 'app' );
var PostModel = require( './model' );
var PostsCollection = Backbone.Collection.extend( {
model : PostModel,
url : app.jsonApi + \"get_posts/\",
parse: function( response ) {
return response.posts;
}
} );
module.exports = PostsCollection;
// SNIPPET:
var ImagePostModel = PostModel.extend( { ... } );
// SNIPPET:
var GalleryPostModel = PostModel.extend( { ... } );
// SNIPPET:
Uncaught TypeError: Object function ( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
} has no method 'cookie'
// SNIPPET:
function renderGrid(render_area, dataURL, skin, loop_index) {
var scope = this;
var grid_obj = loop_index + '_grid';
grid_obj = new dhtmlXGridObject($(render_area).attr('id'));
grid_obj.selMultiRows = true;
grid_obj.imgURL = \"codebase/imgs/\";
grid_obj.init();
grid_obj.setSkin(skin);
grid_obj.load(dataURL);
}
// SNIPPET:
0_grid.attachEvent(\"onRowSelect\",scope.clickEvent);
// SNIPPET:
form.setPristine()
// SNIPPET:
formController
// SNIPPET:
formController
// SNIPPET:
formController
// SNIPPET:
$scope
// SNIPPET:
$('.project-content').load('<g:createLink controller=\"test\" action=\"testDashboard\" params=\" [testInstance:applicationInstance.name]\" />' + \"/\" + new Date().getTime() );
// SNIPPET:
def testDashboard(){
render template: 'testing/testTemplate', model: [applicationInstance: params.get('applicationInstance')],contentType: 'html'
}
// SNIPPET:
<div id=\"price-holder\"></div>
// SNIPPET:
$(\"#price-menu li:nth-child(2)\").click(function() {
var pregHTML = $(\"#cakesmash-price\").html();
$(\"#price-holder\").html(pregHTML);
});
// SNIPPET:
<div id=\"cakesmash-price\" style=\"display:none\">
<img id=\"cake\" src=\"images/order.png\" height=\"32px\" onclick=\"pregbasic(this);\">
</div>
// SNIPPET:
onclick
// SNIPPET:
$(\"#cake\").click(function(){
})
// SNIPPET:
$('#letter-a').mousedown(function(){
$('.letter-b, .letter-c, .letter-g, .letter-h, .letter-i, .letter-m, .letter-n, .letter-o, .letter-r, .letter-s, .letter-t, .letter-u, .letter-w').fadeOut(100, function(){
$('.letter-a').delay(600).fadeIn(500);
});
});
$('#letter-b').mousedown(function(){
$('.letter-a, .letter-c, .letter-g, .letter-h, .letter-i, .letter-m, .letter-n, .letter-o, .letter-r, .letter-s, .letter-t, .letter-u, .letter-w').fadeOut(100, function(){
$('.letter-b').delay(600).fadeIn(500);
});
});
$('#letter-c').mousedown(function(){
$('.letter-a, .letter-b, .letter-g, .letter-h, .letter-i, .letter-m, .letter-n, .letter-o, .letter-r, .letter-s, .letter-t, .letter-u, .letter-w').fadeOut(100, function(){
$('.letter-c').delay(600).fadeIn(500);
});
});
// SNIPPET:
function moveDown(arg) {
smooth = setTimeout(moveDown, 10);
if(!isFirefox){ ///// This works good for Chrome
window.scrollTo(0, window.pageYOffset + 1);
}
if(isFirefox){ /// Does not work in FireFox
console.log(window.pageYOffset) /// Every iteration returns 0
window.scrollTo(0, window.pageYOffset + 1);
console.log(window.pageYOffset) /// Every iteration returns 1
}
// SNIPPET:
function moveDown(arg) {
offset = parseFloat(timeline.style.width) * 7100 / 100;
setTimeout(function() { /// 1 ms - time to calculate offset
window.scroll(0, offset);
}, 1);
if ( typeof arg === 'undefined') { /// makes argument optional
arg = true;
}
if (arg) {
smooth = setTimeout(moveDown, 10); // Timeout makes recursive calls
if (window.pageYOffset > 7100) {
story.pause();
isPlaying = false;
enable_scroll();
animateTimeLine(false);
clearTimeout(smooth);
playButton.style.display = \"block\";
pauseButton.style.display = \"none\";
}
if(!isFirefox){
window.scrollTo(0, window.pageYOffset + 7408 / (story.duration * 47));
}
if(isFirefox){
console.log(window.pageYOffset);
window.scrollTo(0, window.pageYOffset + 7408 / (84 * 47));
console.log(window.pageYOffset);
}
}
if (arg == false) {
clearTimeout(smooth);
}
}
playButton.onclick = function() {
moveDown();
}
// SNIPPET:
<form id=\"fileAttachment\" action=\"@Url.Action(\"AttachFile\", \"Attachment\")\" method=\"post\" enctype=\"multipart/form-data\">
<input type=\"file\" id=\"upload\" name=\"upload\" onChange=\"submitFormOnFileSelection()\"/>
<input type=\"submit\" id=\"xxx\" name=\"asd\" />
</form>
// SNIPPET:
$(document).ready(function () {
var options = {
beforeSend: function () {
},
uploadProgress: function (event, position, total, percentComplete) {
},
success: function () {
},
complete: function(response) {
$(\"#AttachmentArea\").html(response.responseText);
},
error: function () {
$(\"#AttachmentArea\").html(\"<font color='red'> ERROR: unable to upload files</font>\");
}
};
$(\"#fileAttachment\").ajaxForm(options);
});
function submitFormOnFileSelection() {
if ($(\"#upload\").val() != '') {
$('#fileAttachment').submit(function() {
$(\"#fileAttachment\").ajaxSubmit(options);
});
$(\"#upload\").val('');
}
}
// SNIPPET:
<div id=\"1 Chronicles 1:6\" class=\"vs\" > &nbsp;6 And the sons. </div>
// SNIPPET:
def fileopen
my_file = File.new(\"public/CHNAME1.txt\",\"w\")
my_file.write \"\\tfasf\"
my_file.close
end
// SNIPPET:
<button id=\"button\" onclick=\"readfile()\" />
// SNIPPET:
function readfile() {
alert('readfile work')
$.ajax({
alert('ajax work')
url: \"/fileopen\",
type: \"POST\",
##don't know what to do to make fileopen work
}
});
}
// SNIPPET:
match '/fileopen', to:'static_pages#fileopen', via: 'get'
// SNIPPET:
<script>!window.jQuery && document.write(unescape('%3Cscript src=\"jquery-1.7.1.min.js\"%3E%3C/script%3E'))</script>
// SNIPPET:
Markup
// SNIPPET:
Javascript
// SNIPPET:
Markup
// SNIPPET:
Javascript
// SNIPPET:
Markup
// SNIPPET:
Javascript
// SNIPPET:
<tabset>
<tab heading=\"Markup\">content for 1st markup tab</tab>
<tab heading=\"Javascript\">content for 1st javascript tab</tab>
</tabset>
.
.
.
<tabset>
<tab heading=\"Markup\">content for 2nd markup tab</tab>
<tab heading=\"Javascript\">content for 2nd javascript tab</tab>
</tabset>
// SNIPPET:
<div class=\"btn-group\">
<button type=\"button\" class=\"btn btn-primary\" ng-model=\"radioModel\" btn-radio=\"'markup'\">markup</button>
<button type=\"button\" class=\"btn btn-primary\" ng-model=\"radioModel\" btn-radio=\"'javascript'\">javascript</button>
</div>
// SNIPPET:
Uncaught SyntaxError: Unexpected end of input ... application.js:1
// SNIPPET:
var firstTimeExecuting = true; //should execute only once...above function call.
function guessAnal(guess) { ... //Analyze the guess.
// SNIPPET:
stroke
// SNIPPET:
canvas.observe('mouse:down', function(e) {
activeInstance = canvas.getActiveObject();
activeGroupInstance = canvas.getActiveGroup();
if (activeInstance!=null){
activeInstance.set(\"stroke\",\"#FF0000\");
}
}
// SNIPPET:
stroke
// SNIPPET:
property
// SNIPPET:
\"chr\" : \"chr1\", \"begin\" : 39401, \"end\" : 39442
// SNIPPET:
\"chr\" : \"chr1\", \"begin\" : 39401, \"end\" : 39442, \"gene\" : \"GENE1\"
// SNIPPET:
var mapPos = function(){
emit({chr: this.chr, begin:this.begin, end:this.end},{gene:\"\"});
}
var mapGene = function() {
emit({chr: this.chr, begin:this.begin, end:this.end},{gene:this.gene});
}
r = function(key,values){
var result = {gene:\"\"}
values.forEach(function(value){
result.gene = value.gene;
});
return result;
}
res = db.Pos.mapReduce(mapPos, r, {out: {reduce: 'joined'}});
res = db.Gene.mapReduce(mapGene, r, {out: {reduce: 'joined'}});
// SNIPPET:
function onButtonClick(){
var grid = Ext.getCmp('mygridpanel')
var row = grid.getSelectionModel().getSelection()[0];
var txtVehicleID = Ext.getCmp('txtVehicleID').getValue();
var txtPlat_No = Ext.getCmp('txtPlat_No').getValue();
console.log(txtVehicleID);
var record = UserStore.findRecord('_id', txtVehicleID);
record.set('_id', txtVehicleID);
record.set('Plat_No',txtPlat_No);
UserStore.sync({
success: function(batch) {
Ext.MessageBox.show({
title: \"Information\",
msg: batch.operations[0].request.scope.reader.jsonData[\"message\"],
icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK,
fn: function(buttonId) {
if (buttonId === \"ok\") {
EditWin.close();
}
}
});
},
failure: function(batch){
Ext.MessageBox.show({
title: \"Error\",
msg: batch.operations[0].request.scope.reader.jsonData[\"message\"],
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn: function(buttonId) {
if (buttonId === \"ok\") {
// Call back at here
EditWin.close();
}
}
});
}
});
//console.log(\"clicked\");
}
// SNIPPET:
<script type=\"text/javascript\">
<!--
function validateForm()
{
var name=document.getElementsByClassName(\"name\");
if(name[0].value == \"\")
{
alert( \"Please provide your name!\" );
document.myForm.name.focus() ;
return false;
}
else if(!isNaN(name[0].value))
{
alert( \"Enter only alphabets!\" );
document.myForm.name.focus() ;
return false;
}
}
-->
</script>
<form name=\"myform\" onsubmit=\"validateForm()\" action=\"formsubmitted.php\">
<span class=\"required\" title=\"Required Field\">*</span>
<span style=\"font-size:16px; color:#09c;\">Name: </span>
<input class=\"name\" title=\"Enter Your Full Name\" type=\"text\" name=\"name\" value=\"\"/><br/>
<span class=\"required\" title=\"Required Field\">*</span>
<span style=\"font-size:16px;color:#09c;\">Address:</span>
<input class=\"address\" title=\"Enter Address\" type=\"text\" name=\"address\" value=\"\"/><br/>
<span class=\"required\" title=\"Required Field\">*</span>
<span style=\"font-size:16px;color:#09c;\">Contact Number:</span>
<input class=\"contactno\" title=\"Enter Number\" type=\"text\" name=\"contact\" value=\"\"/><br/>
<input class=\"submit\" type=\"submit\" value=\"Submit\"/></span>
</form>
// SNIPPET:
$(document).ready(function(){
$('.add').click(function(event){
var predmet = $('input.clear:last');
$('div.clear').before(predmet.clone().val('').slideToggle( \"fast\" ));
$('div.clear').before(predmet.next().clone().val(0));
event.preventDefault();
});
// SNIPPET:
$(\".desktop-menu li\").hover(function(){
$(\"ul li.active\").removeClass('active');
$(this).stop().addClass('active');
})
// SNIPPET:
$uid = (int)$_GET['id'];
$tariff_query = mysql_query(\"SELECT * FROM ebvouchertariffs WHERE VoucherID_Fk = $uid\");
if(mysql_num_rows($tariff_query)>=1) {
echo \"<table>
<tr>
<td>SL.NO</td>
<td>DATE</td>
<td>PARTICULARS</td>
<td>NO OF NIGHTS</td>
<td>RATE</td>
<td>PRICE</td>
<td>TAX %</td>
</tr>\";
while($t_row = mysql_fetch_array($tariff_query)) {
echo \"<tr>
<td><input type=text name=slno[] value= \". $t_row['TariffSlNo'] .\"></td>
<td><input type=text value=\". $t_row['TariffDate'] .\" name=date[] id=SelectedDate onClick=GetDate(this); readonly=readonly/></td>
<td><input type=text name=particulars[] placeholder=\\\"Description\\\" value=\". $t_row['TariffParticulars'] .\"></td>
<td>\";
echo \"<select name=noofnights[] value= >\";
echo \"<option>\" . $t_row['NoOfNights'] . \"</option>\";
echo \"<option></option>\";
echo \"<option value=1>1</option>
<option value=2>2</option>
<!-- cutted -->
<option value=20>20</option>\";
echo \"</select>\";
echo \"
<input type=text onblur=\\\"this.value=addzeros(this.value)\\\" onKeyUp=\\\"return valtxt(this)\\\" name=rate[] value=\". $t_row['TariffRate'] .\">
<input type=text name=price[] value=\". $t_row['TariffPrice'] .\" readonly=readonly>
<input type=text name=tax[] onblur=\\\"this.value=addzeros(this.value)\\\" onKeyUp=\\\"return valtxt(this)\\\" value=\". $t_row['TariffTax'] .\" >
<input type=hidden name=taxtotal[] readonly=readonly value= ></td>
</tr>\";
}
}
// SNIPPET:
include(\"config.php\");
if(isset($_POST['submit_val'])) {
$uid = (int)$_POST[\"edited\"];
foreach( $_POST['slno'] as $key=>$slno ) {
$e_date = $_POST['date'][$key];
$e_particulars = $_POST['particulars'][$key];
$e_noofnights = $_POST['noofnights'][$key];
$e_rate = $_POST['rate'][$key];
$e_price = $_POST['price'][$key];
$e_tax = $_POST['tax'][$key];
$e_nettotal = $_POST['nettotal'];
$e_totalamount = $_POST['totalamount'];
$e_finaltotal = $_POST['finaltotal'];
$e_slno = mysql_real_escape_string($slno);
$e_date = mysql_real_escape_string($e_date);
$e_particualrs = mysql_real_escape_string($e_particulars);
$e_noofnights = mysql_real_escape_string($e_noofnights);
$e_rate = mysql_real_escape_string($e_rate);
$e_price = mysql_real_escape_string($e_price);
$e_tax = mysql_real_escape_string($e_tax);
$e_nettotal = mysql_real_escape_string($e_nettotal);
$e_totalamount = mysql_real_escape_string($e_totalamount);
$e_finaltotal = mysql_real_escape_string($e_finaltotal);
$e_tariff = \"UPDATE ebvouchertariffs SET TariffSlNo = '$e_slno', TariffDate = '$e_date', TariffParticulars = '$e_particulars', NoOfNights = '$e_noofnights', TariffRate = '$e_rate', TariffPrice = '$e_price', TariffTax = '$e_tax', TariffNetTotal = '$e_nettotal', TariffAddTotal = '$e_totalamount', TariffFinalTotal = '$e_finaltotal', ModifiedOn = NOW() WHERE VoucherID_Fk = '$uid'\";
}
mysql_query($e_tariff)or die(mysql_error());
mysql_close($link);
}
// SNIPPET:
content: {sections: [ {title: 'section 1 ' htmlunits: ['<div..>' , '<div..>'] } ] }
// SNIPPET:
<div id=\"content\">
<ul class=\"section\" data-title=\"section 1\">
<li class=\"htmlunit\"> '<div..>' </li>
li class=\"htmlunit\"> '<div..>' </li>
</ul>
<div>
// SNIPPET:
(seems like SO is censoring the xml....)
<xml>
<content>
<section title=\"section 1\">
<htmlunit> '<div..>' </htmlunit>
<htmlunit> '<div..>' </htmlunit>
</section>
<content>
</xml>
// SNIPPET:
<style>
.thumb {
height: 75px;
border: 1px solid #000;
margin: 10px 5px 0 0;
}
</style>
<input type=\"file\" id=\"files\" name=\"files[]\" multiple />
<output id=\"list\"></output>
<script>
function handleFileSelect(evt) {
var files = evt.target.files; // FileList object
// Loop through the FileList and render image files as thumbnails.
for (var i = 0, f; f = files[i]; i++) {
// Only process image files.
if (!f.type.match('image.*')) {
continue;
}
var reader = new FileReader();
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
// Render thumbnail.
var span = document.createElement('span');
span.innerHTML = ['<img class=\"thumb\" src=\"', e.target.result,
'\" title=\"', escape(theFile.name), '\"/>'].join('');
document.getElementById('list').insertBefore(span, null);
};
})(f);
// Read in the image file as a data URL.
reader.readAsDataURL(f);
}
}
document.getElementById('files').addEventListener('change', handleFileSelect, false);
</script>
// SNIPPET:
$('#thisfile').change(function(){
handleFileSelect(this)
});
// SNIPPET:
TypeError: evt.target is undefined
// SNIPPET:
var myUrl = \"http://....er.com\";
function getJson() {
jQuery.ajax({
url: myUrl,
dataType: \"json\",
contentType: \"application/json\",
timeout: 3000,
async: false,
cache: false,
success: function (respJSON) {
console.log(\"OK\");
},
error: function () {
console.log(\"NOTOK\");
}
});
}
// SNIPPET:
{\"RESPONSE_CODE\" : \"OK\",\"RESPONSE_MESSAGE\" : [{\"id\" : \"9\",\"denominazione\" : \"ADV0001\",\"lat\" : \"0\",\"lng\" : \"0\",\"idTerritorio\" : \"1\",\"idCRM\" : \"MOVENTU\"}]}
// SNIPPET:
Uncaught TypeError: Cannot read property 'loader' of undefined
// SNIPPET:
<div data-dojo-type=\"dijit/Dialog\" id=\"DetailDialog\" class=\"dijitDialog\" ...
// SNIPPET:
var dlg = dijit.byId(\"DetailDialog\");
dlg.set(\"content\", this.Details);
dlg.show();
this._grid.refresh();
dlg.resize();
domStyle.set(dojo.byId('fDetailDialog'), {
left: \"162px\"
});
// SNIPPET:
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
this._BtAdd.Attributes.Add(\"onclick\", \"GXDualListBox_MoveDualList(\" + sourceListId + \", \" + destListId + \", \" + selectedValuesId + \", false, true, \"+ this._SortByDescription +\");\");
this._BtRemove.Attributes.Add(\"onclick\", \"GXDualListBox_MoveDualList(\" + destListId + \", \" + sourceListId + \", \" + selectedValuesId + \", false, false, \" + this._SortByDescription + \");\");
if (!this._PostBackOnAll)
{
this._BtAddAll.Attributes.Add(\"onclick\", \"GXDualListBox_MoveDualList(\" + sourceListId + \", \" + destListId + \", \" + selectedValuesId + \", true, true, \" + this._SortByDescription + \" );\");
this._BtRemoveAll.Attributes.Add(\"onclick\", \"GXDualListBox_MoveDualList(\" + destListId + \", \" + sourceListId + \", \" + selectedValuesId + \", true, false, \" + this._SortByDescription + \" );\");
}
// Check if user can double-click on listbox item to move it
if (this._AllowDblClick)
{
this._LstSource.Attributes.Add(\"ondblclick\", \"GXDualListBox_MoveDualList(\" + sourceListId + \", \" + destListId + \", \" + selectedValuesId + \", false, true, \" + this._SortByDescription + \" );\");
this._LstDestination.Attributes.Add(\"ondblclick\", \"GXDualListBox_MoveDualList(\" + destListId + \", \" + sourceListId + \", \" + selectedValuesId + \", false, false, \" + this._SortByDescription + \" );\");
}
}
// SNIPPET:
function GXDualListBox_MoveDualList(srcList, destList, selectedValues, moveAll, isAdd,sortByDescription)
{
if ((srcList.selectedIndex == -1) && (moveAll == false)) {
return;
}
newDestList = new Array(destList.options.length);
for (var len = 0; len < destList.options.length; len++) {
if (destList.options[len] != null) {
newDestList[len] = new Option(destList.options[len].text, destList.options[len].value, destList.options[len].defaultSelected, destList.options[len].selected);
}
}
for (var i = 0; i < srcList.options.length; i++) {
if (srcList.options[i] != null && (srcList.options[i].selected == true || moveAll)) {
newDestList[len] = new Option(srcList.options[i].text, srcList.options[i].value, srcList.options[i].defaultSelected, srcList.options[i].selected);
len++;
}
}
if (sortByDescription) {
newDestList.sort(GXDualListManager_CompareOptionValues);
newDestList.sort(GXDualListManager_CompareOptionText);
}
for (var j = 0; j < newDestList.length; j++) {
if (newDestList[j] != null) {
destList.options[j] = newDestList[j];
}
}
}
if (isAdd)
buildSelectedList(destList, selectedValues);
else
buildSelectedList(srcList, selectedValues);
}
// SNIPPET:
$(\"h3.expand\").toggler({initShow: \"div.currview\"});
// SNIPPET:
\"div.currview\"
// SNIPPET:
({initShow: \"div.currview\"})
// SNIPPET:
window.scope = 'global'
Object.prototype.scope = 'object proto'
console.log(scope);
// SNIPPET:
string=\"Talk Talk Walk Walk sell sell\";
// SNIPPET:
string[0]='Talk Talk';
string[1]='Walk Walk';
string[2]='sell sell';
// SNIPPET:
setInterval(function(){ $(\"#nav #nextslide\").click()},10000);
// SNIPPET:
<a href=\"site.html\" class=\"gallery form_click\">click.</a>
// SNIPPET:
a
// SNIPPET:
a
// SNIPPET:
var foo = function(){};
foo.prototype.a = function(){
return 'foo';
};
// SNIPPET:
var bar = new Foo();
console.log(bar.a);
// SNIPPET:
require('./foo.js');
require('./bar.js');
// SNIPPET:
SyntaxError: Unexpected token {
// SNIPPET:
var myArray = [4, 6, 23, 10, 1, 3];
var arrayAdditon = function (arr) {
var largestNumber = arr[0];
var sumTotal;
for (var i = 0; i < arr.length; i += 1) {
if (arr[i] > largestNumber) {
largestNumber = arr[i];
}
}
for (var i = 0; i < arr.length; i += 1) {
if (largestNumber) {
console.log(largestNumber);
} else (arr[i] != largestNumber) {
sumTotal += arr[i];
}
}
if (largestNumber === sumTotal) {
return true;
} else {
return false;
}
}
// SNIPPET:
google.maps.event.addListener(map, 'click', function(event) {
// SNIPPET:
var xhrvar=$http.post('HitThisURL',
{\"inputData\" :$scope.inputData
}).success(function(data){
alert(\"I am out \"+data);
}).error(function(data){});
// SNIPPET:
xhrvar.abort();
// SNIPPET:
#signup
// SNIPPET:
#account
// SNIPPET:
if(localStorage.hasAnAccount){
$('#signup').hide();
$('#AccountName').html(localStorage.accountName)
}else{
$('#account').hide();
}
function createNewAccount(){
localStorage.accountName=$('#newAccountName').html();
localStorage.accountPassword=$('newAccountPassword').html();
if(typeof localStorage.accountName=='string'&& typeof localStorage.accountPassword=='string'){
alert('congrats! Your account has been made!');
localStorage.hasAnAccount=true;
}else{
alert('check that your name and password are alphanumeric strings');
}
}
// SNIPPET:
<html>
<head>
<title>Account | Cicada3301's Website</title>
<link rel='stylesheet' type='text/css' href='http://www.copot.eu/matei/assets/stylesheet.css'>
<link rel='stylesheet' href='http://www.copot.eu/matei/assets/jquery-ui-stylesheet.css'>
<script type=\"text/javascript\" src=\"http://www.copot.eu/matei/assets/jquery-1.10.2.min.js\"></script>
<script src=\"http://www.copot.eu/matei/assets/jquery-ui.js\"></script>
<script type=\"text/javascript\" src=\"http://www.copot.eu/matei/assets/scripts.js\"></script>
<script type='text/javascript' src='http://www.copot.eu/matei/account/account-scripts.js'></script>
<link rel='shortcut icon' type='image/x-icon' href='http://www.copot.eu/matei/assets/me.jpg'>
</head>
<body>
<div id='account'>
<div id='AccountName'></div>
</div>
<div id='signup'>
<p><input type='text' id='newAccountName'> Insert your account name</p>
<p><input type='text' id='newAccountPassword'> Insert your account password</p>
<p><input type='button' onclick='createNewAccount()' value='Create Account'></p>
</div>
</body>
</html>
// SNIPPET:
localStorage
// SNIPPET:
localStorage
// SNIPPET:
$(document).ready(function(){
if (localStorage.hasAnAccount) {
$('#signup').hide();
$('#AccountName').html(localStorage.accountName)
} else {
$('#account').hide();
}
$('#createNewAccount').click(
function () {
if (typeof localStorage.accountName == 'string' && typeof localStorage.accountPassword == 'string') {
localStorage.accountName = $('#newAccountName').val();
localStorage.accountPassword = $('newAccountPassword').val();
alert('congrats! Your account has been made!');
localStorage.hasAnAccount = true;
} else {
alert('check that your name and password are alphanumeric strings');
}
});
})
// SNIPPET:
SCRIPT1002: Syntax error
File: jquery.js, Line: 7993, Column: 6
// SNIPPET:
function showThisMonths DocInSite() {
var done = false;
var page =SitesApp.getPageByUrl('https://sites.google.com/a/guhsd.net/apexenglish/home/calendar');
page.setHtmlContent(\"\");
var files = DocsList.getFolderById('0B_vP7FM9qvx3VkNQS0FCaW1YbzQ').getFiles();
var d=new Date();
var month=new Array();
month[0]=\"jan\";
month[1]=\"feb\";
month[2]=\"mar\";
month[3]=\"apr\";
month[4]=\"may\";
month[5]=\"jun\";
month[6]=\"jul\";
month[7]=\"aug\";
month[8]=\"sep\";
month[9]=\"oct\";
month[10]=\"nov\";
month[11]=\"dec\";
var n = month[d.getMonth()];
var yr = d.getYear();
while (!done) {
try {
for (i in files) {
var filenm = files[i].getName();
filenm = filenm.toLowerCase();
if ((filenm.indexOf(n) > -1) && (filenm.indexOf(yr) > -1)) {
var myid = files[i].getId();
}
}
done = true;
}
catch(e){
}
var mycontent = '<div style=\"margin-left:auto;margin-right:auto;width:850px\"><iframe src=\"https://docs.google.com/document/d/' + myid + '\" width=\"850\" height=\"1200\" scrolling=\"auto\"></iframe></div>';
page.setHtmlContent(mycontent);
}
}
// SNIPPET:
<asp:DropDownList ID=\"dd_j_name\" CssClass=\"select2\" runat=\"server\" PlaceHolder=\"Select Journal\" AutoPostBack=\"True\" > </asp:DropDownList>
<asp:ImageButton ID=\"btn_submit\" runat=\"server\" Text=\"Submit\" OnClientClick=\"return validaterev();\" ImageUrl=\"images/btn-submit1.jpg\" />
// SNIPPET:
.cs code
// SNIPPET:
dd_j_name.DataSource = rr_j_title;
dd_j_name.DataValueField = \"EditorId1\";
dd_j_name.DataTextField = \"Title\";
dd_j_name.DataBind();
dd_j_name.Items.Insert(0, \"\");
// SNIPPET:
<script language=\"javascript\" type=\"text/javascript\">
function validaterev() {
if (document.getElementById(\"<%=dd_j_name.ClientID%>\").value == \"Select Journal\" || document.getElementById(\"<%=dd_j_name.ClientID%>\").value == \"\")
{
alert(\"Required to Select Journal\");
document.getElementById(\"<%=dd_j_name.ClientID%>\").focus();
return false;
}
}
</script>
// SNIPPET:
function test(sender) {
if (sender[0].checked)
{
var controlid = document.getElementById(\"RadioButtonList1\");
controlid[0].checked = true;
}
<asp:RadioButtonList ID=\"RadioButtonList1\" runat=\"server\"
RepeatDirection=\"Horizontal\"
OnSelectedIndexChanged=\"RadioButtonList1_SelectedIndexChanged\" onclick=\"validate()\">
<asp:ListItem >YES</asp:ListItem>
<asp:ListItem >NO</asp:ListItem>
</asp:RadioButtonList>
<asp:RadioButtonList ID=\"RadioButtonList2\" runat=\"server\" RepeatDirection=\"Horizontal\">
<asp:ListItem onclick=\"test()\">YES</asp:ListItem>
<asp:ListItem onclick=\"test()\">NO</asp:ListItem>
</asp:RadioButtonList>
// SNIPPET:
if (jQuery( \".mobile_swap\" ).css('height') == '100%' ){
console.log(\"worked\");
} else {
console.log(\"nope\");
}
// SNIPPET:
if (jQuery( \".mobile_swap\" ).css('height') == '100px' ){
console.log(\"worked\");
} else {
console.log(\"nope\");
}
// SNIPPET:
self.selectedOrgId.subscribe(function (currentOrgId) {
alert(currentOrgId);
}, self);
// SNIPPET:
[
{\"userGuid\":\"37ab100e-f97b-462a-b3f4-79b8fbe24831\",
\"orgId\":1,
\"orgName\":
\"company ltd\",
\"isHiring\":true,
...snip...}
more...
]
// SNIPPET:
w = window.open();
w.document.write(data);
w.print();
w.close();
// SNIPPET:
<html>
<head>
<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE8\">
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<jsp:include page=\"Header.jsp\" flush=\"true\"></jsp:include>
<script type=\"text/javascript\" src=\"/js/diceCommonUtilities.js?<%=Reset.iSOLVERSION_NUMBER%>\"></script>
<script type=\"text/javascript\" src=\"/js/prototype.js?<%=Reset.iSOLVERSION_NUMBER%>\"></script>
<script type=\"text/javascript\" src=\"/js/Utilities.js?<%=Reset.iSOLVERSION_NUMBER%>\"></script>
<script type=\"text/javascript\" src=\"/js/Quickcreate.js?<%=Reset.iSOLVERSION_NUMBER%>\"></script>
// SNIPPET:
<script type=\"text/javascript\" src=\"/js/jquery-1.7.min.js?<%=Reset.iSOLVERSION_NUMBER%>\"></script>
<script type=\"text/javascript\" src=\"/js/jquery-ui.js?<%=Reset.iSOLVERSION_NUMBER%>\"></script>
<script type=\"text/javascript\" src=\"/js/jquery.datePicker.js?<%=Reset.iSOLVERSION_NUMBER%>\"></script>
<script type=\"text/javascript\" src=\"/js/jquery.bgiframe.pack.js?<%=Reset.iSOLVERSION_NUMBER%>\" ></script>
<script type=\"text/javascript\" src=\"/js/jquery.blockUI.js?<%=Reset.iSOLVERSION_NUMBER%>\"></script>
// SNIPPET:
<input type=\"text\" name=\"nume\" value=\"\" placeholder=\"Nume\" /><br />
<input type=\"text\" name=\"prenume\" value=\"\" placeholder=\"Prenume\" /><br />
<input type=\"text\" name=\"username\" value=\"\" placeholder=\"Username\" /><br />
<input type=\"password\" name=\"password1\" value=\"\" placeholder=\"Parola\" /><br />
<input type=\"email\" name=\"email1\" value=\"\" placeholder=\"E-mail\" /><br />
<input type=\"checkbox\" name=\"reguli\" id=\"reguli\" required >
<label for=\"reguli\">I agree with the website rules</label><br />
<input type=\"submit\" name=\"cont\" value=\"Creare cont\" />
// SNIPPET:
filter_functions: {
MySelectBox :{
\"Show all\" : function(e, n, f, i) {
return ; // Show all entries
},
\"Newest\": function(e, n, f, i) {
return ; // Today's entries
}
}
}
// SNIPPET:
Marionette.Application.extend({
regions: {
mainRegion: function(){return someCondition?\"#A\":\"#B\"},
otherRegion: \"#something\"
}
})
// SNIPPET:
if(typeof obj == \"function\") {
this.data.obj = obj();
}
else {
this.data.obj = obj;
}
// SNIPPET:
$(\"#textBoxId\").select2({
placeholder: 'Select a product',
formatResult: productFormatResult,
formatSelection: productFormatSelection,
dropdownClass: 'bigdrop',
escapeMarkup: function(m) { return m; },
formatNoMatches: function( term ) {
return \"<li class='select2-no-results'>\"+\"No results found.<button class='btn btn-success pull-right btn-xs' onClick='modal()'>Add New Item</button></li>\";
},
minimumInputLength:1,
ajax: {
url: '/api/productSearch',
dataType: 'json',
data: function(term, page) {
return {
q: term
};
},
results: function(data, page) {
return {results:data};
}
}
});
// SNIPPET:
formatNoMatches: function( term ) {
$('.select2-input').on('keyup', function(e) {
if(e.keyCode === 13)
{
$(\"#modalAdd\").modal();
}
});
return \"<li class='select2-no-results'>\"+\"No results found.<button class='btn btn-success pull-right btn-xs' onClick='modal()'>Add New Item</button></li>\";
},
// SNIPPET:
controller.js
// SNIPPET:
app.controller('MetaDetailGroupList', ['$scope', '$http', function($scope, $http) {
$http.get(Routing.generate('meta-detail-group-list')).success(function(data) {
$scope.MetaDetailGroup = data;
$scope.orderProp = 'name';
$scope.currPage = 0;
$scope.pageSize = 10;
$scope.totalMetaDetailGroup = function() {
return Math.ceil($scope.MetaDetailGroup.entities.length / $scope.pageSize);
};
}).error(function(data, status, headers, config) {
$scope.MetaDetailGroup.message = \"Ocurrieron errores al procesar los datos, por favor vuelva a intentarlo.\";
});
}]);
// SNIPPET:
parent >> children
// SNIPPET:
From: $http.get(Routing.generate('meta-detail-group-list')).success(function(data)
To: $http.get(Routing.generate('meta-detail-group-list' + '/'+id)).success(function(data)
// SNIPPET:
<div class=\"product-container\">
<div class=\"product-price\">Price info</div>
</div>
<div class=\"product-container\">
<div class=\"product-price\">Price info</div>
<div class=\"production-options\">
<select id=\"selectoptions1\" name=\"product1\" class=\"attribute_list\">
<option value=\"Colour (please select)\">Colour (please select)</option>
<option value=\"White\">White</option>
<option value=\"Navy Blue\">Navy Blue</option>
</select>
</div>
</div>
<div class=\"product-container\">
<div class=\"product-price\">Price info</div>
</div>
// SNIPPET:
production-options
// SNIPPET:
product-options
// SNIPPET:
product-price
// SNIPPET:
if($( \".product-options\")) {
$( \".product-price\" ).css( \"padding-top\", \"20px\" );
}
// SNIPPET:
product-price
// SNIPPET:
product-price
// SNIPPET:
product-options
// SNIPPET:
if(contractStatus != null || contractStatus!='')
{
window.opener.document.getElementById('contractStatus').value=contractStatus;
}
// SNIPPET:
<template name=\"myscripts\">
<script src=\"myexternalscript\"></script>
<script src=\"anotherexternalscript></script>
<script src=\"anotherexternalscript\"></script>
<script>
//internal script code here
</script>
</template>
// SNIPPET:
{{myscripts}}
// SNIPPET:
<!--HTML here-->
<!--some elements here
after the last div on this template page, I wanted to add my scripts.-->
<div>
</div>
<script src=\"some external script\"></script>
<script src=\"some external script\"></script>
<!--Now my internal script-->
<script>
(function() {
// Base template
var base_tpl =
\"<!doctype html>\\n\" +
\"<html>\\n\\t\" +
\"<head>\\n\\t\\t\" +
\"<meta charset=\\\"utf-8\\\">\\n\\t\\t\" +
\"<title>Test</title>\\n\\n\\t\\t\\n\\t\" +
\"</head>\\n\\t\" +
\"<body>\\n\\t\\n\\t\" +
\"</body>\\n\" +
\"</html>\";
var prepareSource = function() {
var html = html_editor.getValue(),
css = css_editor.getValue(),
js = js_editor.getValue(),
src = '';
src = base_tpl.replace('</body>', html + '</body>');
css = '<style>' + css + '</style>';
src = src.replace('</head>', css + '</head>');
js = '<script>' + js + '<\\/script>';
src = src.replace('</body>', js + '</body>');
return src;
};
var render = function() {
var source = prepareSource();
var iframe = document.querySelector('#output iframe'),
iframe_doc = iframe.contentDocument;
iframe_doc.open();
iframe_doc.write(source);
iframe_doc.close();
};
var cm_opt = {
mode: 'text/html',
gutter: true,
lineNumbers: true,
};
var html_box = document.querySelector('#html textarea');
var html_editor = CodeMirror.fromTextArea(html_box, cm_opt);
html_editor.on('change', function (inst, changes) {
render();
});
cm_opt.mode = 'css';
var css_box = document.querySelector('#css textarea');
var css_editor = CodeMirror.fromTextArea(css_box, cm_opt);
css_editor.on('change', function (inst, changes) {
render();
});
cm_opt.mode = 'javascript';
var js_box = document.querySelector('#js textarea');
var js_editor = CodeMirror.fromTextArea(js_box, cm_opt);
js_editor.on('change', function (inst, changes) {
render();
});
var cms = document.querySelectorAll('.CodeMirror');
for (var i = 0; i < cms.length; i++) {
cms[i].style.position = 'absolute';
cms[i].style.top = '30px';
cms[i].style.bottom = '0';
cms[i].style.left = '0';
cms[i].style.right = '0';
cms[i].style.height = '100%';
}
/*cms = document.querySelectorAll('.CodeMirror-scroll');
for (i = 0; i < cms.length; i++) {
cms[i].style.height = '100%';
}*/
}());
</script>
// SNIPPET:
$('.substract-value').click(function(){
val = $('#how-many').val();
if (val == 1)
{ }
else
$('#how-many').val(val-1);
});
$('.add-value').click(function(){
val = $('#how-many').val();
$('#how-many').val(parseInt(val)+1);
});
// SNIPPET:
var dataset = [[1,3,3,5,6,7],[3,5,8,3,2,6],[9,0,6,3,6,3],[3,4,4,5,6,8],[3,4,5,2,1,8]];
var svg = d3.select(\"body\")
.append(\"svg\")
.attr(\"width\", w)
.attr(\"height\", h);
svg.append(\"g\")
.selectAll(\"p\")
.data(dataset)
.enter()
.append(\"p\") //removing
.selectAll(\"text\") // these
.data( function(d,i,j) { return d; } ) //lines
.enter() //text displays normally
.append(\"text\")
.text( function(d,i,j) { return d; } )
.attr(\"x\", function(d,i,j) { return (i * 20) + 40; })
.attr(\"y\", function(d,i,j) { return (i * 20) + 40; })
.attr(\"font-family\", \"sans-serif\")
.attr(\"font-size\", \"20px\")
.attr(\"fill\", textColour);
// SNIPPET:
$(\".thumbnail\").click(function() {
$(this).addClass(\"selected\").siblings().removeClass(\"selected\");
})
// SNIPPET:
.thumbnail {
background: #dddddd;
width: 42px;
height: 42px;
margin-bottom: 5px;
}
.thumbnail:hover {
cursor: pointer;
}
.thumbnail.selected {
width: 36px;
height: 36px;
border: 3px solid #C72D30;
}
// SNIPPET:
<section>
<div class=\"thumbnail\"></div>
</section>
<section>
<div class=\"thumbnail\"></div>
</section>
<section>
<div class=\"thumbnail\"></div>
<div class=\"thumbnail\"></div>
<div class=\"thumbnail\"></div>
</section>
// SNIPPET:
(document).ready
// SNIPPET:
(document).ready
// SNIPPET:
$(document).ready(function () {
$(\"#ASPxSplitter1_ContentPlaceHolder1_uctActivityEntry1_tbActivity_tbHistory_btnApproveActivity_btnApprove\").click(function () {
$(\"#ASPxSplitter1_ContentPlaceHolder1_uctActivityEntry1_tbActivity_tbHistory_btnApproveActivity_lblMessage\").text(GetConfirmTextForApprove());
});
});
// SNIPPET:
GetConfirmTextForApproval()
// SNIPPET:
node server.js
// SNIPPET:
\"dependencies\": {
\"express\": \"~3.4.8\",
\"mongodb\": \"1.1.8\",
\"socket.io\": \"0.9.10\",
\"backbone\": \"~1.1.1\",
\"bootstrap\": \"0.0.2\",
\"node.js\": \"0.0.0\"
},
\"engines\": {
\"node\": \"0.8.4\",
\"npm\": \"1.1.49\"
}
// SNIPPET:
e3-a69c-3a07d518e05a fwd=\"50.157.213.109\" dyno=web.1 connect=0ms service=3ms status=304
bytes=238
2014-02-17T14:35:35.140966+00:00 app[web.1]:
2014-02-17T14:35:35.141400+00:00 app[web.1]: http.js:691
2014-02-17T14:35:35.141652+00:00 app[web.1]: throw new Error('Can\\'t set headers after they are sent.');
2014-02-17T14:35:35.141652+00:00 app[web.1]: ^
2014-02-17T14:35:35.144602+00:00 app[web.1]: Error: Can't set headers after they are sent.
2014-02-17T14:35:35.140544+00:00 app[web.1]: GET / 304 2ms
2014-02-17T14:35:35.144602+00:00 app[web.1]: at SendStream.send (/app/node_modules/express/node_modules/send/lib/send.js:348:8)
2014-02-17T14:35:35.144602+00:00 app[web.1]: at /app/node_modules/express/node_modules/send/lib/send.js:323:10
2014-02-17T14:35:35.144602+00:00 app[web.1]: at Object.oncomplete (fs.js:107:15)
2014-02-17T14:35:35.140544+00:00 app[web.1]: GET / 304 2ms
2014-02-17T14:35:35.144602+00:00 app[web.1]: at ServerResponse.OutgoingMessage.setHeader (http.js:691:11)
2014-02-17T14:35:35.144602+00:00 app[web.1]: at ServerResponse.res.setHeader (/app/node_modules/express/node_modules/connect/lib/patch.js:63:22)
2014-02-17T14:35:35.144602+00:00 app[web.1]: at SendStream.type (/app/node_modules/express/node_modules/send/lib/send.js:456:7)
2014-02-17T14:35:36.268983+00:00 heroku[web.1]: Process exited with status 8
2014-02-17T14:35:36.284405+00:00 heroku[web.1]: State changed from up to crashed
2014-02-17T14:35:36.286612+00:00 heroku[web.1]: State changed from crashed to starting
2014-02-17T14:35:38.836042+00:00 heroku[web.1]: Starting process with command `node serverwithanalytics.js`
2014-02-17T14:35:40.503178+00:00 app[web.1]: connect.multipart() will be removed in connect 3.0
2014-02-17T14:35:40.503366+00:00 app[web.1]: visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
2014-02-17T14:35:40.504851+00:00 app[web.1]: connect.limit() will be removed in connect 3.0
2014-02-17T14:35:40.508557+00:00 app[web.1]: info: socket.io started
2014-02-17T14:35:40.514996+00:00 app[web.1]: Express server listening on port 44412
2014-02-17T14:35:43.280881+00:00 heroku[router]: at=info method=GET path=/css/bootstrap-responsive.css host=peaceful-waters-4142.herokuapp.com request_id=3a5ed1cc-1065-4e74-ba1d-91cb0b799e6c fwd=\"50.157.213.109\" dyno=web.1 connect=1ms service=68ms status=304 bytes=239
2014-02-17T14:35:43.275568+00:00 app[web.1]: GET /css/bootstrap-responsive.css 304 42ms
2014-02-17T14:35:43.287066+00:00 app[web.1]:
2014-02-17T14:35:43.288991+00:00 app[web.1]: http.js:691
2014-02-17T14:35:43.286558+00:00 app[web.1]: GET /css/bootstrap-responsive.css 304 53ms
2014-02-17T14:35:43.295520+00:00 app[web.1]: at SendStream.type (/app/node_modules/express/node_modules/send/lib/send.js:456:7)
2014-02-17T14:35:43.291840+00:00 app[web.1]: throw new Error('Can\\'t set headers after they are sent.');
2014-02-17T14:35:43.291840+00:00 app[web.1]: ^
2014-02-17T14:35:43.295520+00:00 app[web.1]: at ServerResponse.OutgoingMessage.setHeader (http.js:691:11)
2014-02-17T14:35:43.295520+00:00 app[web.1]: Error: Can't set headers after they are sent.
2014-02-17T14:35:43.295520+00:00 app[web.1]: at ServerResponse.res.setHeader (/app/node_modules/express/node_modules/connect/lib/patch.js:63:22)
2014-02-17T14:35:43.295520+00:00 app[web.1]: at SendStream.send (/app/node_modules/express/node_modules/send/lib/send.js:348:8)
2014-02-17T14:35:43.295520+00:00 app[web.1]: at /app/node_modules/express/node_modules/send/lib/send.js:323:10
2014-02-17T14:35:43.295520+00:00 app[web.1]: at Object.oncomplete (fs.js:107:15)
2014-02-17T14:35:45.002412+00:00 heroku[web.1]: State changed from up to crashed
2014-02-17T14:35:44.989848+00:00 heroku[web.1]: Process exited with status 8
// SNIPPET:
<head>
<title>Parking Lot App</title>
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />
<link rel=\"stylesheet\" href=\"themes/florida_tech.min.css\" />
<link rel=\"stylesheet\" href=\"http://code.jquery.com/mobile/1.3.1/jquery.mobile.structure-1.3.1.min.css\" />
<script src=\"http://code.jquery.com/jquery-1.9.1.min.js\"></script>
<script src=\"http://code.jquery.com/ui/1.10.3/jquery-ui.js\"></script>
<script src=\"http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js\"></script>
<script src=\"jquery.ui.touch-punch.min.js\"></script> <!-- TOUCH PUNCH -->
</head>
// SNIPPET:
<div data-role=\"content\" style=\"margin:0px; padding:0px; border:0px\">
<div id=\"draggable\" class=\"ui-widget-content\" style=\"position:relative; height: 347px\">
<div style=\" position: absolute; top: 0px; left: 0px\">
<img src=\"style/pic.png\" alt=\"Parking Lot Map\"/>
</div>
<div style=\"background-color:green; width:17px; height:35px; z-index: 2; position: absolute; top: 31px; left: 81px \">
&nbsp
</div>
<div style=\"background-color:green; width:17px; height:35px; z-index: 2; position: absolute; top: 31px; left: 102px \">
&nbsp
</div>
</div>
// SNIPPET:
<script type=\"text/javascript\">
function checkboxlimit(checkgroup, limit){
var checkgroup=checkgroup
var limit=limit
for (var i=0; i<checkgroup.length; i++){
checkgroup[i].onclick=function(){
var checkedcount=0
for (var i=0; i<checkgroup.length; i++)
checkedcount+=(checkgroup[i].checked)? 1 : 0
if (checkedcount>limit){
alert(\"You can only select a maximum of \"+limit+\" checkboxes\")
this.checked=false
}
}
}
}
</script>
<form id=\"world\" name=\"world\" method=\"post\" action=\"example2.php\">
<select name=\"dropdown\" onclick=\"Calc(world)\">
<option value=\"\"></option>
<option value=\"school\">School</option>
<option value=\"college\">College</option>
</select>
<p>Countries:</p>
<input type=\"checkbox\" name=\"countries[]\" value=\"USA\" /> USA<br />
<input type=\"checkbox\" name=\"countries[]\" value=\"Canada\" /> Canada<br />
<input type=\"checkbox\" name=\"countries[]\" value=\"Japan\" /> Japan<br />
<input type=\"checkbox\" name=\"countries[]\" value=\"China\" /> China<br />
<input type=\"checkbox\" name=\"countries[]\" value=\"France\" /> France<br />
<input type=\"submit\" value=\"Submit\">
</form>
<script type=\"text/javascript\">
function Calc(world){
var entersel1 = document.world.dropdown.value;
if (entersel1 == ''){
checkboxlimit(document.forms.world.countries[], 0)
}
else if(entersel1 == 'school'){
checkboxlimit(document.forms.world.countries[], 2)
}
else{
checkboxlimit(document.forms.world.countries[], 3)
}
}
</script>
// SNIPPET:
<?php
$dropdown = $_POST['dropdown'];
$countries = implode(',', $_POST['countries']);
echo $dropdown.'<br>'.$countries;
?>
// SNIPPET:
$(window).resize(function() {
if ($(window).width() < 1024) {
$('.side-by-side div').each(function() {
$(this).insertAfter($(this).parent().find('img'));
});
});
// SNIPPET:
$(window).resize(function() {
if ($(window).width() < 1024) {
var $each = $('.side-by-side div').each();
$(each).insertAfter($(this).parent().find('img'));
});
});
// SNIPPET:
$('.side-by-side div').each(function() {
$(this).insertAfter($(this).parent().find('img'));
});
// SNIPPET:
<div id=\"morrisline\" style=\"height: 250px;\"></div>
// SNIPPET:
Morris.Bar({
element: 'barchart',
axes: true,
data: Object.keys(json.bar).map(function(key) {return json.bar[key]}),
xkey: 'x',
ykeys: ['a', 'b']
});
// SNIPPET:
{
\"bar1\": {
\"x\": \"1/1/2014\",
\"a\": \"9\",
\"b\": \"6\"
},
\"bar2\": {
\"x\": \"1/2/2014\",
\"a\": \"5\",
\"b\": \"7\"
},
\"bar3\": {
\"x\": \"1/3/2014\",
\"a\": \"8\",
\"b\": \"9\"
},
\"bar4\": {
\"x\": \"1/4/2014\",
\"a\": \"7\",
\"b\": \"9\"
}
}
// SNIPPET:
$(document).ready(function() {var cb = function(start, end) {
$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
// SNIPPET:
(function ($, window, undefined) {
\"use strict\";
$(document).ready(function ($) {
$.getJSON( \"js/data.json\", function( json ) {
//console.log(Object.keys(json.line).map(function(key) {return json.line[key]}));
if (typeof Morris != 'undefined') {
//Bar chart
Morris.Bar({
element: 'barchart',
axes: true,
data: Object.keys(json.bar).map(function(key) {return json.bar[key]}),
resize: true,
xkey: 'x',
ykeys: ['a', 'b']
});
}
});
});
})(jQuery, window);
// SNIPPET:
function OnCellClick(param1, param2) {
var urlAJAX = @Url.Action(\"GetJson\", \"PosicaoEstoque\", new { p1 = param1 , p2 =param2}); }
// SNIPPET:
var array = new Array(100);
for (var i=2 ; i<=array.length-1; i++) {
if((i%2===0) || (i%3===0))
continue;
document.writeln(i+\",\");
}
// SNIPPET:
5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47, 49, 53, 55, 59, 61, 65, 67, 71, 73, 77, 79, 83, 85, 89, 91, 95, 97
// SNIPPET:
<script type=\"text/javascript\">
var MAX_COUNTER = 900;
var counter = null;
var counter_interval = null;
function setCookie(name,value,days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = \"; expires=\"+date.toGMTString();
}
else {
expires = \"\";
}
document.cookie = name+\"=\"+value+expires+\"; path=/\";
}
function getCookie(name) {
var nameEQ = name + \"=\";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1,c.length);
}
if (c.indexOf(nameEQ) === 0) {
return c.substring(nameEQ.length,c.length);
}
}
return null;
}
function deleteCookie(name) {
setCookie(name,\"\",-1);
}
function resetCounter() {
counter = MAX_COUNTER;
}
function stopCounter() {
window.clearInterval(counter_interval);
deleteCookie('counter');
}
function updateCounter() {
var msg = '';
if (counter > 0) {
counter -= 1;
hours = parseInt(counter / 3600);
counter = counter % 3600;
minutes = parseInt(counter / 60);
seconds = parseInt(counter % 60);
msg = hours +\" jam :\"+ minutes +\" menit :\"+ seconds +\" detik\";
setCookie('counter', counter, 1);
}
else {
msg = \"Waktu Habis.\";
stopCounter();
alert(\"Waktu Habis.\");
document.form.submit();
}
var el = document.getElementById('counter');
if (el) {
el.innerHTML = msg;
}
}
function startCounter() {
stopCounter();
counter_interval = window.setInterval(updateCounter, 1000);
}
function init() {
counter = getCookie('counter');
if (!counter) {
resetCounter();
}
startCounter();
}
init();
function disable_f5(e){
if((e.which||e.keyCode)==116){
e.preventDefault();
}
}
$(document).ready(function(){
$(document).bind(\"keydown\",disable_f5);
});
</script>
// SNIPPET:
<script type=\"text/javascript\">
<!--
function getCheckedRad() {
radNum = getCookie(cookieName)
if(!radNum){
return
}
temp=radNum.split(\"&\")
for(var i=0;i<temp.length;i++){
el=document.getElementById(\"set\"+i)
myInputs=el.getElementsByTagName(\"INPUT\")
myInputs[temp[i]].checked=true
}
}
function saveCheckedRad(){
var exp = new Date()
exp.setTime(exp.getTime() + (expDays*24*60*60*1000))
c=0
radNum=\"\"
while(document.getElementById(\"set\"+c)){
el=document.getElementById(\"set\"+c)
myInputs=el.getElementsByTagName(\"INPUT\")
for(var i=0;i<myInputs.length;i++){
if(myInputs[i].checked){
radNum+=i+\"&\"
}
}
c++
}
setCookie(cookieName,radNum,exp)
}
cookieName=\"checked_rad2\"
expDays=365
function setCookie(name, value, expires, path, domain, secure){// An adaptation of Dorcht's function for setting a cookie.
if (!expires){expires = new Date()}
document.cookie = name + \"=\" + escape(value) +
((expires == null) ? \"\" : \"; expires=\" + expires.toGMTString()) +
((path == null) ? \"\" : \"; path=\" + path) +
((domain == null) ? \"\" : \"; domain=\" + domain) +
((secure == null) ? \"\" : \"; secure\")
}
function getCookie(name){
var arg = name + \"=\"
var alen = arg.length
var clen = document.cookie.length
var i = 0
while (i < clen) {
var j = i + alen
if (document.cookie.substring(i, j) == arg)
return getCookieVal(j)
i = document.cookie.indexOf(\" \", i) + 1
if (i == 0) break
}
return null
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (\";\", offset)
if (endstr == -1)
endstr = document.cookie.length
return unescape(document.cookie.substring(offset, endstr))
}
function deleteCookie(name,path,domain) { // An adaptation of Dorcht's function for deleting a cookie.
document.cookie = name + \"=\" +
((path == null) ? \"\" : \"; path=\" + path) +
((domain == null) ? \"\" : \"; domain=\" + domain) +
\"; expires=Thu, 01-Jan-00 00:00:01 GMT\"
}
// add onload=\"getCheckedRad()\" onunload=\"saveCheckedRad()\" to the opening BODY tag
//-->
</script>
// SNIPPET:
<input type=\"radio\" name=\"sex\" value=\"male\">Male
<input type=\"radio\" name=\"sex\" value=\"female\">Female
// SNIPPET:
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src=\"js/jquery-1.10.2.min.js\"></script>
<script>
$(document).ready(function(){
$(\"#btn\").click(function(){
Do();
})
});
function Do(){
$(\".container\").fadeOut(\"slow\",function(){
$(this).fadeIn(\"slow\",function(){Do();});
});
}
</script>
<style type=\"text/css\">
.container{
background: yellow;
width: 200px;
height: 50px;
font-size: 20px;
}
</style>
</head>
<body>
<button type=\"button\" id=\"btn\">Push Me</button>
<div id=\"container\" class=\"container\">
Hello
</div>
<div id=\"container2\" class=\"container\">
Hello
</div>
<div id=\"container3\" class=\"container\">
Hello
</div>
</body>
</html>
// SNIPPET:
.slideToggle()
// SNIPPET:
callback: {
complete: function(number){
$(\"#slides\").find(\"slidesjs-index=\\\"\"+number+\"\\\"\").children(\".cap\").slideToggle();
}
}
// SNIPPET:
Uncaught Error: Syntax error, unrecognized expression: slidesjs-index=\"2\"
// SNIPPET:
slidesjs-index=\"(index of the automatically enumerated element)\"
// SNIPPET:
$('input.datepicker').datepicker()
// SNIPPET:
load
// SNIPPET:
var slide={
init:function(){
$('#section-heading-images').children('div.slide_image').each(function(index){
if(! $(this).hasClass('active')){
$(this).show();
}
//var diff=$('#section-heading-images').height() - $(this).children('div.slide_text_container').height() ;
//$(this).children('div.slide_text_container').css('top',diff);
if(! $(this).hasClass('active')){
$(this).hide();
}
});
}
}
var headimages={
slideSwitch:function(){
var current=$('#section-heading-images div.active');
var next;
if(current.next('div.slide_image').length > 0){
next=current.next();
}else{
next=current.parent().children('div.slide_image:first');
}
headimages.showNextSlide(current,next);
},
setSlides:function(){
$('span.section-heading-pointer').click(function(){
$('div.slide_image').stop(true,true)
var current_id=$(this).attr('id').substr(24);
//var next=$('#section-heading-image-'+current_id);
var current=$('#section-heading-images div.active');
headimages.showNextSlide(current,current_id);
});
},
showNextSlide:function(current,next){
//Next is a jQuery object
if(next instanceof $) {
navNext = $(\"#slide-switcher > .active\").next();
if(navNext.attr(\"class\") != \"section-heading-pointer\" && navNext.attr(\"class\") != \"section-heading-pointer \") navNext = $(\"#section-heading-pointer-0\");
}
//Next is an id
else{
var nid = next;
next=$('#section-heading-image-'+nid);
var navNext = $(\"#section-heading-pointer-\"+nid);
}
// Put the existing on top
$(current).removeClass('active');
$(next).addClass('active');
$(\"#slide-switcher > .active\").removeClass(\"active\");
$(navNext).addClass(\"active\");
// Reveal the next slide underneath the current
$(next).show();
$(current).css('z-index',1);
// Fade the current slide out
$(current).fadeOut(1500);
// Put the revealed slide on top
$(next).css('z-index',0);
},
init:function(){
var minheight=0;
$('#section-heading').children('div.slide_image').each(function(index){
$(this).show();
if(minheight==0){
minheight=$(this).height();
}
if($(this).height < minheight){
minheight=$(this).height();
}
$(this).hide();
});
headimages.setSlides();
}
}
$(document).ready(function() {
if($('#section-heading').length > 0){
headimages.init();
slide.init();
if($('#section-heading-images').children('div.slide_image').length > 1){
setInterval( \"headimages.slideSwitch()\", 8000);
}else{
$('#slide-switcher').hide();
}
}
$('span.arrow_right').click(function(){
$('div.slide_image').stop(true,true)
var current_id=$(this).attr('id').substr(24);
//var next=$('#section-heading-image-'+current_id);
var current=$('#section-heading-images div.active');
headimages.showNextSlide(current,current_id);
});
});
// SNIPPET:
<div id=\"section-heading\">
<div id=\"section-heading-images\">
<div id=\"section-heading-image-0\" class=\"slide_image\">
<div class=\"image-container\">
<img src=\"image_zero.jpg\" alt=\"\" height=\"330\" width=\"1000\">
</div>
</div>
<div id=\"section-heading-image-1\" class=\"slide_image\">
<div class=\"image-container\">
<img src=\"image_one.jpg\" alt=\"\" height=\"330\" width=\"1000\">
</div>
</div>
<div id=\"section-heading-image-2\" class=\"slide_image\">
<div class=\"image-container\">
<img src=\"image_two.jpg\" alt=\"\" height=\"330\" width=\"1000\">
</div>
</div>
<div id=\"section-heading-selectors\">
<div id=\"slide-switcher\">
<span class=\"section-heading-pointer\" id=\"section-heading-pointer-0\"></span>
<span class=\"section-heading-pointer\" id=\"section-heading-pointer-1\"></span>
<span class=\"section-heading-pointer\" id=\"section-heading-pointer-2\"></span>
<span class=\"pause-slide\">Pause</span>
<span class=\"play-slide\">Play</span>
</div>
</div>
</div>
// SNIPPET:
var elemTr = $(\"<tr>\", {
});
var elemEmpName = $(\"<div>\", { }).data('otherDtls', {
recordId: 10
});;
// SNIPPET:
elemTr.append(jQuery(\"<td>\", {}).append(elemEmpName));
// SNIPPET:
ShowInScreen(ListOfObject)
// SNIPPET:
bootbox.alert
// SNIPPET:
function ShowInScreen(ListOfObject) {
var ListOfProduct = ListOfObject;
ListOfProduct.forEach(function (entry)
{
bootbox.alert(entry.product.name);
});
}
// SNIPPET:
event
// SNIPPET:
ui
// SNIPPET:
$(document).tooltip({
show: null,
position: {
my: \"left top\",
at: \"left bottom\"
},
open: function( event, ui ) {
alert(event.target)
ui.tooltip.animate({ top: ui.tooltip.position().top + 10 }, \"fast\" );
}
});
// SNIPPET:
<button id=\"btnA\">
// SNIPPET:
<button id=\"btnB\">
// SNIPPET:
divs
// SNIPPET:
bars
// SNIPPET:
fx
// SNIPPET:
table
// SNIPPET:
btnA
// SNIPPET:
btnB
// SNIPPET:
$(\"#btnA\").click(function() {
$(this).removeClass(\"btn-default\")
$(this).addClass(\"btn-success\")
$(\"#btnB\").removeClass(\"btn-success\")
$(\"#btnB\").addClass(\"btn-default\")
$(\"#table\").remove()
$(\"#bars\").switchClass(\"barsdiferencias barslagrange\")
$(\"#fx\").switchClass(\"fxdiferencias fxlagrange\")
})
$(\"#btnB\").click(function() {
$(this).removeClass(\"btn-default\")
$(this).addClass(\"btn-success\")
$(\"#btnA\").removeClass(\"btn-success\")
$(\"#btnA\").addClass(\"btn-default\")
$(\"#graficos\").append('<div id=\"table\" class=\"table\"></div>')
$(\"#bars\").switchClass(\"barslagrange barsdiferencias\")
$(\"#fx\").switchClass(\"fxlagrange fxdiferencias\")
})
// SNIPPET:
switchClass
// SNIPPET:
toggleClass
// SNIPPET:
<object id='myExperience' class='BrightcoveExperience'>
<param name='bgcolor' value='#FFFFFF' />
<param name='width' value='480' />
<param name='height' value='270' />
<param name='playerID' value='2119278990001' />
<param name='playerKey' value='AQ~~,AAABtOucX_k~,lzAbJ4EGCWOe52SAdLGfbpIpAw34U8gW'/>
<param name='isVid' value='true' />
<param name='isUI' value='true' />
<param name='dynamicStreaming' value='true' />
<param name='includeAPI' value='true' />
<param name='@videoPlayer' value='2806424814001' />
<param name='templateLoadHandler' value='myTemplateLoaded' />
<param name='templateReadyHandler' value='onTemplateReady' />
<param name='secureConnections' value='true' />
<param name='secureHTMLConnections' value='true' />
<param name='wmode' value='transparent' />
</object>
// SNIPPET:
http://example.com/categories/listing/all-categories?src=home
// SNIPPET:
[^/]*(?=\\?)
// SNIPPET:
http://example.com/categories/listing/*all-categories*?src=home
// SNIPPET:
var reg = /[^\\/]*(?=\\?)/i;
var url = document.location.href;
var subcat = reg.exec(url);
alert(subcat);
// SNIPPET:
list.addEventListener('scroll', function () {
var elements = document.querySelectorAll('.aBox');
var toBe = counter - 1 - elements.length;
for (var i = 0; i < elements.length; i++) {
var inView = visibleY(elements[i]),
ele = elements[i].querySelector('.item');
if (inView === false && ele) {
console.log(\"Not in visible, keeping it none\");
var height = elements[i].clientHeight;
elements[i].style.height = height + \"px\";
elements[i].innerHTML = \"\";
} else if(!ele){
console.log('Placing the content');
var minArray = arr[toBe + 1 + i],
str = \"\";
for (var j = 0; j < minArray.length; j++) {
str += \"<div class='item'>\" + minArray[j] + \"</div>\";
}
elements[i].innerHTML = str;
}
}
});
// SNIPPET:
function updateData(callback) {
var elements = document.querySelectorAll('.aBox');
elements = Array.prototype.slice.call(elements);
var toBe = counter - 1 - elements.length;
async.each(elements, function (element, cb) {
var inView = $(element).is_on_screen(),
ele = element.querySelector('.item');
if (inView == false && ele) {
console.log(\"Not in visible, keeping it none\");
var height = element.clientHeight;
element.style.height = height + \"px\";
element.innerHTML = \"\";
} else if (!ele && inView) {
console.log('Placing the content');
var minArray = arr[toBe + 1 + i],
str = \"\";
if (typeof minArray === \"object\") {
for (var j = 0; j < minArray.length; j++) {
str += \"<div class='item'>\" + minArray[j] + \"</div>\";
}
element.innerHTML = str;
}
}
cb();
}, function () {
callback()
});
}
// SNIPPET:
BICYCLING Specifies a bicycling directions request.
DRIVING Specifies a driving directions request.
TRANSIT Specifies a transit directions request.
WALKING Specifies a walking directions request.
// SNIPPET:
function list_products () {
$get = mysql_query('SELECT `id`, `SKU`, `sub`, `pname`, `desc`, `price`, `ship`, `qty`, `cat` FROM `products` ORDER BY `id` DESC');
if (mysql_num_rows($get) == 0) {
echo \"There are no product to display!\";
} else {
while ($get_row = mysql_fetch_assoc($get)) {
echo
'<h5>'.$get_row['pname'].' id: '.$get_row['id'].'</h5>
<form action=\"delete_product.php\" method=\"post\">
<input type=\"hidden\" value=\"'.$get_row['id'].'\" name=\"id\">
<input type=\"submit\" name=\"submit\" value=\"DELETE\" class=\"btn btn-lg btn-danger\">
</form>
<form action=\"update_p.php\" method=\"post\">
<input type=\"hidden\" placeholder=\"'.$get_row['id'].'\" name=\"id\" value=\"'.$get_row['id'].'\">
<label>SKU:</label>
<input type=\"text\" placeholder=\"'.$get_row['SKU'].'\" name=\"SKU\" value=\"'.$get_row['SKU'].'\" required=\"\">
<label>Name:</label>
<input type=\"text\" placeholder=\"'.$get_row['pname'].'\" name=\"pname\" required=\"\" value=\"'.$get_row['pname'].'\">
<label>Subtitle:</label>
<textarea rows=\"2\" maxlength=\"46\" name=\"desc\" placeholder=\"'.$get_row['sub'].'\" required=\"\">'.$get_row['sub'].'</textarea>
<label>Description:</label>
<textarea rows=\"4\" name=\"desc\" placeholder=\"'.$get_row['desc'].'\" required=\"\">'.$get_row['desc'].'</textarea>
<label>Price:</label>
<input type=\"text\" placeholder=\"'.number_format($get_row['price'], 2).'\" name=\"price\" value=\"'.number_format($get_row['price'], 2).'\" required=\"\">
<label>Shipping:</label>
<input type=\"text\" placeholder=\"'.number_format($get_row['ship'], 2).'\" name=\"ship\" value=\"'.number_format($get_row['ship'], 2).'\" required=\"\">
<label>Quantity:</label>
<input type=\"text\" placeholder=\"'.$get_row['qty'].'\" name=\"qty\" value=\"'.$get_row['qty'].'\" required=\"\">
<label>Category:</label>
<input type=\"text\" placeholder=\"'.$get_row['cat'].'\" name=\"cat\" value=\"'.$get_row['cat'].'\" required=\"\"><br>
<input type=\"submit\" name=\"submit\" value=\"EDIT\" class=\"btn btn-success btn-lg\">
</form>
<hr>
';
};
}
}
// SNIPPET:
if (empty($_POST) === false && empty($errors) === true) {
$id = $_POST['id'];
$update_data = array(
'pname' => $_POST['pname'],
'desc' => $_POST['desc'],
'price' => $_POST['price'],
'ship' => $_POST['ship'],
'qty' => $_POST['qty'],
'cat' => $_POST['cat']
);
update_product($id, $update_data);
// SNIPPET:
function update_product($id, $update_data) {
$update = array();
array_walk($update_data);
foreach($update_data as $field=>$data) {
$update[] = '`' . $field . '` = \\'' . $data . '\\'';
}
mysql_query(\"UPDATE `products` SET \" . implode(', ', $update) . \" WHERE `id` = $id\");
}
// SNIPPET:
<script type=\"text/javascript\">
function baunilha()
{
var qb=document.getElementById(\"quantbaunilha\").innerHTML;
var prbau=5.58;
var totbau=qtd*prbau;
}
document.getElementById(\"valorlinhab\").innerHTML=baunilha();
</script>
// SNIPPET:
<tr>
<td><img src=\"/imagens/DOB_Baunilha.PNG\" style=\"vertical-align: middle\" alt=\"Ima_Bau\"> </td>
<td>Caixa de 42 Unidoses de Detergente Ultra-Concentrado aroma Baunilha</td>
<td><input id=\"quantbaunilha\" name=\"quantbaunilha\" value=\"0\" maxlength=\"2\" type=\"text\" size=\"2\" onchange=\"baunilha()\"></td>
<td><input id=\"valorunib\" name=\"valorunib\" size=\"6\" value=\"5.58\">€</td>
<td><input id=\"valorlinhab\" name=\"valorlinhab\" size=\"8\" value=\"0.00\">€</td>
</tr>
// SNIPPET:
<script type=\"text/javascript\">
$(document).ready(function () {
debugger;
var austDay = new Date();
var currDay = new Date();
$.ajax({
type: 'GET',
url: '/Service/Utility/GetDownDate',
success: function (data) {
austDay = new Date(parseInt(data.newDate.substr(6)));
//alert(austDay);
}
});
austDay = new Date(austDay.getFullYear(), 1 - 1, 26);
alert(austDay);
$('#defaultCountdown').countdown({ until: austDay });
$('#year').text(austDay.getFullYear());
});
</script>
// SNIPPET:
<li>
<a id=\"myLink\" href=\"#\" onclick=\"window.print();return false;\">Print</a>
</li>
// SNIPPET:
#social-bar,#footer-copyright,#modal-reported,#modal-voted,#block- user-container,#thevideoplayer
{
display:none;
}
// SNIPPET:
RUR.runner.eval_javascript = function (src) {
// Note: by having \"use strict;\" here, it has the interesting effect of requiring user
// programs to conform to \"strict\" usage, meaning that all variables have to be declared,
// etc.
\"use strict\"; // will propagate to user's code, enforcing good programming habits.
// lint, then eval
editorUpdateHints();
if(editor.widgets.length === 0) {
libraryUpdateHints();
if(library.widgets.length !== 0) {
$('#library-problem').show().fadeOut(4000);
}
}
RUR.reset_definitions();
eval(src); // jshint ignore:line
};
// SNIPPET:
<input type=\"text\" class=\"validate[required,dateRange[grp1],custom[date] text-input datepicker\" name=\"daterange\" id=\"start_date\" value=\"\">
<input type=\"text\" class=\"validate[required,dateRange[grp1],custom[date] text-input datepicker\" name=\"daterange\" id=\"end_date\" value=\"\">
// SNIPPET:
//Camera Variables
float x,y,z;
float tx,ty,tz;
float rotX,rotY;
float mX, mY;
float frameCounter;
float xComp, zComp;
float angle;
//Movement Variables
int moveX;
int moveZ;
float vY;
boolean canJump;
boolean moveUP,moveDOWN,moveLEFT,moveRIGHT;
//check input
int m =0;
//Constants
int ground = 0;
int totalBoxes = 100;
int standHeight = 100;
int dragMotionConstant = 10;
int pushMotionConstant = 100;
int movementSpeed = 50; //Bigger number = slower
float sensitivity = 15; //Bigger number = slower
int stillBox = 100; //Center of POV, mouse must be stillBox away from center to move
float camBuffer = 10;
int cameraDistance = 1000; //distance from camera to camera target in lookmode... 8?
//Options
int lookMode = 8;
int spotLightMode = 4;
int cameraMode = 1;
int moveMode = 2;
void setup(){
size(800,600,P3D);
noStroke();
//dwa(#EDEDE8);
//Camera Initialization
//default
x = -28;
y = height/2;
y-= standHeight;
z = -4830;
tx = width/2;
ty = height/2;
tz = 0;
rotX = 0;
rotY = 0;
xComp = tx - x;
zComp = tz - z;
angle = 0;
//Movement Initialization
moveX = 0;
moveX = 0;
moveUP = false;
moveDOWN = false;
moveLEFT = false;
moveRIGHT = false;
canJump = true;
vY = 0;
}
void draw(){
if(z<-5000)
z=-5000;
if(z>9700)
z=9700;
//println(x,y,z ,mouseX , mouseY ,tx ,ty,tz);
//update frame
background(0);
lights();
if(m==1)
{
//rotateY(0.5);
fill(#EAFF0F);
textSize(50);
text(\"menu\", x-100, y, z+300);
// rotateY(0.5);
//the point
pushMatrix();
fill(#FC1919);
translate(-28,300,4000);
box(10, 20000, -10);
popMatrix();
//the point
}
if(spotLightMode == 0)
lights();
else if(spotLightMode == 1)
spotLight(255,255,255,x,y-standHeight,z,tx,ty,tz,PI,1);
else if(spotLightMode == 2)
spotLight(255,255,255,x,y-standHeight-200,z,x+100,y+100,z,frameCounter/10,1);
else if(spotLightMode == 3)
spotLight(255,255,255,width/2,height/2-1000,0,width/2,height/2,0,PI,1);
else if(spotLightMode == 4)
{
pointLight(255,255,255,x,y,z);
}
/*
for(int i=1;i<=7;i++)
{
spotLight(255, 255, 255, -28, 2000, -5500+i*1875, 1, 1, 1, 360, 1);
}*/
//-5500 9500s
//back wall
pushMatrix();
fill(255);
translate(-28,300,-5500);
box(15000, 5000, -100);
popMatrix();
//back wall
//fount wall
pushMatrix();
fill(255);
translate(-28,300,10500);
box(15000, 5000, -100);
popMatrix();
//fount wall
//L1
bookshielf(800,-4000,7,1);
bookshielf(1000,-4000,7,1);
bookshielf(1200,-4000,7,1);
bookshielf(1400,-4000,7,1);
cameraUpdate();
locationUpdate();
jumpManager(10);
//Camera Mode 1 - Original
if(cameraMode == 1)
camera(x,y,z,tx,ty,tz,0,1,0);
//Camera Mode 2 - Matrix'd
/* if(cameraMode == 2){
beginCamera();
camera();
translate(x,y,z);
translate(0,2*-standHeight,0);
rotateX(rotY/100.0); //This seems to work o.o
rotateY(-rotX/100.0);
//rotateX(rotX/100.0);
endCamera();
}*/
//frameCounter++;
}
void cylinder(float w, float h, int sides)
{
float angle;
float[] x = new float[sides+1];
float[] z = new float[sides+1];
translate(0,100,-500);
//get the x and z position on a circle for all the sides
for(int i=0; i < x.length; i++){
angle = TWO_PI / (sides) * i;
x[i] = sin(angle) * w;
z[i] = cos(angle) * w;
}
//draw the top of the cylinder
beginShape(TRIANGLE_FAN);
vertex(0, -h/2, 0);
for(int i=0; i < x.length; i++){
vertex(x[i], -h/2, z[i]);
}
endShape();
//draw the center of the cylinder
beginShape(QUAD_STRIP);
for(int i=0; i < x.length; i++){
vertex(x[i], -h/2, z[i]);
vertex(x[i], h/2, z[i]);
}
endShape();
//draw the bottom of the cylinder
beginShape(TRIANGLE_FAN);
vertex(0, h/2, 0);
for(int i=0; i < x.length; i++){
vertex(x[i], h/2, z[i]);
}
endShape();
}
public void bookshielf(int thex ,int thez ,int theheight ,int therotate)
{
fill(#938056);
if(theheight==7)
{
if(therotate==1)
{
//left
pushMatrix();
translate(thex,0,thez);
box(20, 500, -100);
popMatrix();
//right
pushMatrix();
translate(thex-200,0,thez);
box(20, 500, -100);
popMatrix();
//back
pushMatrix();
translate(thex-100,0,thez+40);
box(220, 500, -30);
popMatrix();
//middle side
for(int i=1;i<7;i++)
{
pushMatrix();
translate(thex-100,-250+71.5*i,thez-10);
box(220, 5, -100);
popMatrix();
}
//top
pushMatrix();
translate(thex-100,250,thez);
box(220, 10, -100);
popMatrix();
//block
pushMatrix();
translate(thex-100,-250,thez);
box(220, 10, -100);
popMatrix();
}
if(therotate==2)
{
//left
pushMatrix();
translate(thex,0,thez);
box(20, 500, -100);
popMatrix();
//right
pushMatrix();
translate(thex-200,0,thez);
box(20, 500, -100);
popMatrix();
//back
pushMatrix();
translate(thex-100,0,thez-40);
box(220, 500, -30);
popMatrix();
//middle side
for(int i=1;i<7;i++)
{
pushMatrix();
translate(thex-100,-250+71.5*i,thez+10);
box(220, 5, -100);
popMatrix();
}
//top
pushMatrix();
translate(thex-100,250,thez);
box(220, 10, -100);
popMatrix();
//block
pushMatrix();
translate(thex-100,-250,thez);
box(220, 10, -100);
popMatrix();
}
}
}
public void cameraUpdate(){
ty=constrain(dragMotionConstant, -100000, 500000);
//Drag-motion
if (lookMode == 1){
if(pmouseX > mouseX)
tx += dragMotionConstant;
else if (pmouseX < mouseX)
tx -= dragMotionConstant;
if(pmouseY > mouseY)
ty -= dragMotionConstant/1.5;
else if (pmouseY < mouseY)
ty += dragMotionConstant/1.5;
}
//Push-motion
else if (lookMode == 2){
if (mouseX > (width/2+pushMotionConstant))
tx += dragMotionConstant;
else if (mouseX < (width/2-pushMotionConstant))
tx -= dragMotionConstant;
if (mouseY > (height/2+pushMotionConstant))
ty += dragMotionConstant;
else if (mouseY < (height/2-pushMotionConstant))
ty -= dragMotionConstant;
}
//Push-motion V2 (Hopefully improved!)
else if (lookMode == 3){
int diffX = mouseX - width/2;
int diffY = mouseY - width/2;
if (abs(diffX) > pushMotionConstant)
tx += diffX/25;
if (abs(diffY) > pushMotionConstant)
ty += diffY/25;
}
//Push Motion V3 (For Camera-Mode 2)
else if (lookMode == 4){
int diffX = mouseX - width/2;
int diffY = mouseY - width/2;
//println(diffX);
if (abs(diffX) > pushMotionConstant)
rotX += diffX/100;
if (abs(diffY) > pushMotionConstant)
rotY += diffY/100;//diffY/100;
}
//Push Motion V4.1 (Because it crashed and I lost V4.0 T.T
//Designed to work in cohesion with movement mode 2
else if (lookMode == 5){
int diffX = mouseX - width/2;
int diffY = mouseY - width/2;
if(abs(diffX) > stillBox){
xComp = tx - x;
zComp = tz - z;
angle = degrees(atan(xComp/zComp));
//
// SNIPPET:
// SNIPPET:
// SNIPPET:
DEBUG STUFF GOES HERE
// SNIPPET:
// SNIPPET:
// SNIPPET:
-
//println(\"tx: \" + tx);
//println(\"tz: \" + tz);
// println(\"xC: \" + xComp);
// println(\"zC: \" + zComp);
// println(\"Angle: \" +angle);
//
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
--*/
if (angle < 45 && angle > -45 && zComp < 0)
tx += diffX/sensitivity;
else if (angle < 45 && angle > -45 && zComp > 0)
tx -= diffX/sensitivity;
//Left Sector
else if (angle > 45 && angle < 90 && xComp < 0 && zComp < 0)
tz -= diffX/sensitivity;
else if (angle >-90 && angle <-45 && xComp < 0 && zComp > 0)
tz -= diffX/sensitivity;
//Right Sector
else if (angle <-45 && angle >-90)
tz += diffX/sensitivity;
else if (angle < 90 && angle > 45 && xComp > 0 && zComp > 0)
tz += diffX/sensitivity;
}
if (abs(diffY) > stillBox)
ty += diffY/(sensitivity/1.5);
}
//Lookmode 4.2
//Using a more proper unit circle.
else if (lookMode == 6){
int diffX = mouseX - width/2;
int diffY = mouseY - width/2;
if(abs(diffX) > stillBox){
xComp = tx - x;
zComp = tz - z;
angle = correctAngle(xComp,zComp);
//
// SNIPPET:
// SNIPPET:
// SNIPPET:
DEBUG STUFF GOES HERE
// SNIPPET:
// SNIPPET:
// SNIPPET:
-
// println(\"tx: \" + tx);
// println(\"tz: \" + tz);
// println(\"xC: \" + xComp);
/// println(\"zC: \" + zComp);
/// println(\"Angle: \" +angle);
//
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
--*/
//Looking 'forwards'
if ((angle >= 0 && angle < 45) || (angle > 315 && angle < 360))
tx += diffX/sensitivity;
//Looking 'left'
else if (angle > 45 && angle < 135)
tz += diffX/sensitivity;
//Looking 'back'
else if (angle > 135 && angle < 225)
tx -= diffX/sensitivity;
//Looking 'right'
else if (angle > 225 && angle < 315)
tz -= diffX/sensitivity;
}
if (abs(diffY) > stillBox)
ty += diffY/(sensitivity/1.5);
}
//Lookmode 7, trying to get rid of the slowdown in the corners with a sorta-buffer thing
else if (lookMode == 7){
int diffX = mouseX - width/2;
int diffY = mouseY - width/2;
if(abs(diffX) > stillBox){
xComp = tx - x;
zComp = tz - z;
angle = correctAngle(xComp,zComp);
//
// SNIPPET:
// SNIPPET:
// SNIPPET:
DEBUG STUFF GOES HERE
// SNIPPET:
// SNIPPET:
// SNIPPET:
-
// println(\"tx: \" + tx);
// println(\"tz: \" + tz);
// println(\"xC: \" + xComp);
// println(\"zC: \" + zComp);
// println(\"Angle: \" +angle);
//
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
--*/
//Looking 'forwards'
if ((angle >= 0-camBuffer && angle < 45+camBuffer) || (angle > 315-camBuffer && angle < 360+camBuffer))
tx += diffX/sensitivity;
//Looking 'left'
else if (angle > 45-camBuffer && angle < 135+camBuffer)
tz += diffX/sensitivity;
//Looking 'back'
else if (angle > 135-camBuffer && angle < 225+camBuffer)
tx -= diffX/sensitivity;
//Looking 'right'
else if (angle > 225-camBuffer && angle < 315+camBuffer)
tz -= diffX/sensitivity;
}
if (abs(diffY) > stillBox)
ty += diffY/(sensitivity/1.5);
}
else if (lookMode == 8){
int diffX = mouseX - width/2;
int diffY = mouseY - width/2;
if(abs(diffX) > stillBox){
xComp = tx - x;
zComp = tz - z;
angle = correctAngle(xComp,zComp);
angle+= diffX/(sensitivity*10);
if(angle < 0)
angle += 360;
else if (angle >= 360)
angle -= 360;
float newXComp = cameraDistance * sin(radians(angle));
float newZComp = cameraDistance * cos(radians(angle));
tx = newXComp + x;
tz = -newZComp + z;
//
// SNIPPET:
// SNIPPET:
// SNIPPET:
DEBUG STUFF GOES HERE
// SNIPPET:
// SNIPPET:
// SNIPPET:
-
/*println(\"tx: \" + tx);
println(\"tz: \" + tz);
println(\"xC: \" + xComp);
println(\"NewXC: \" + newXComp);
println(\"zC: \" + zComp);
println(\"NewZC: \" + newZComp);
println(\"Angle: \" +angle);*/
//
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
--*/
}
if (abs(diffY) > stillBox)
ty += diffY/(sensitivity/1.5);
}
}
public void locationUpdate(){
/*Old method==================================
if(keyPressed){
if (keyCode == UP || key == 'w'){
z-=10;
tz-=10;
}
else if (keyCode == DOWN || key == 's'){
tz+=10;
z+=10;
}
else if (keyCode == LEFT || key == 'a' ){
tx-=10;
x-=10;
}
else if (keyCode == RIGHT || key == 'd'){
tx+=10;
x+=10;
}
}
============================================*/
//Apply Movement
if(moveMode == 1){
z += moveZ;
tz += moveZ;
x += moveX;
tx += moveX;
}
else if(moveMode == 2){
if(moveUP){
z += zComp/movementSpeed;
tz+= zComp/movementSpeed;
x += xComp/movementSpeed;
tx+= xComp/movementSpeed;
}
else if(moveDOWN){
z -= zComp/movementSpeed;
tz-= zComp/movementSpeed;
x -= xComp/movementSpeed;
tx-= xComp/movementSpeed;
}
if (moveRIGHT){
z += xComp/movementSpeed;
tz+= xComp/movementSpeed;
x -= zComp/movementSpeed;
tx-= zComp/movementSpeed;
}
if (moveLEFT){
z -= xComp/movementSpeed;
tz-= xComp/movementSpeed;
x += zComp/movementSpeed;
tx+= zComp/movementSpeed;
}
}
//New method also uses keyPressed() and keyReleased()
// Scroll Down!
}
public void jumpManager(int magnitude){
/*
if(keyPressed && key == ' ' && canJump){
vY -= magnitude;
if(vY < -20)
canJump = false;
}
else*/ if (y < ground+standHeight)
vY ++;
else if (y >= ground+standHeight){
vY = 0;
y = ground + standHeight;
}
if((!canJump) && (!keyPressed)){
//println(\"Jump Reset!\");
canJump = true;
}
y += vY;
}
public void keyPressed(){
if(keyCode == UP || key == 'w'){
moveZ = -10;
moveUP = true;
}
else if(keyCode == DOWN || key == 's'){
moveZ = 10;
moveDOWN = true;
}
else if(keyCode == LEFT || key == 'a'){
moveX = -10;
moveLEFT = true;
}
else if(keyCode == RIGHT || key == 'd'){
moveX = 10;
moveRIGHT = true;
}
if(key == 'm' && m==1){
m=0;
}
else if(key == 'm' && m==0){
if(key == '1')
{
}
rotateY(180);
fill(#EAFF0F);
textSize(50);
text(\"menu\", x-100, y, z+300);
m=1;
}
}
public void keyReleased(){
if(keyCode == UP || key == 'w'){
moveUP = false;
moveZ = 0;
}
else if(keyCode == DOWN || key == 's'){
moveDOWN = false;
moveZ = 0;
}
else if(keyCode == LEFT || key == 'a'){
moveLEFT = false;
moveX = 0;
}
else if(keyCode == RIGHT || key == 'd'){
moveRIGHT = false;
moveX = 0;
}
}
void mousePressed()
{
}
public float correctAngle(float xc, float zc){
float newAngle = -degrees(atan(xc/zc));
if (xComp > 0 && zComp > 0)
newAngle = (90 + newAngle)+90;
else if (xComp < 0 && zComp > 0)
newAngle = newAngle + 180;
else if (xComp < 0 && zComp < 0)
newAngle = (90+ newAngle) + 270;
return newAngle;
}
// SNIPPET:
<form data-parsley-ui-enabled=\"false\"...
// SNIPPET:
isValid() == false
// SNIPPET:
obj.options.i18n.<LANGUAGE_CODE>.[obj.constraints[n].name]
// SNIPPET:
<--Javascript code-->
function showDiv(idInfo) {
var sel = document.getElementById('divLinks').getElementsByTagName('div');
for (var i=0; i<sel.length; i++) {
sel[i].style.display = 'none';
}
document.getElementById('container'+idInfo).style.display = 'block';
}
// SNIPPET:
<--PHP Code-->
<?php
include 'config-admin-marriages.php';
if (isset($_POST['lastname'])) { $one=$_POST['lastname']; }
if (isset($_POST['firstname'])) { $two=$_POST['firstname']; }
$sql = 'SELECT * FROM names WHERE ';
if (!empty($one) && !empty($two)) {
$sql.=\"glast like :lastname and gfirst like :firstname or blast like :lastname and bfirst like :firstname\";
} elseif (!empty($one)) {
$sql.=\"glast like :lastname or blast like :lastname\";
} else {
$sql.=\"gfirst like :firstname or bfirst like :firstname\";
}
$stmt = $conn->prepare($sql);
foreach ($_POST as $key => $value)
{
if (!empty($value)) {
$mod=\"$value%\";
$stmt->bindValue(':'.$key, $mod);
}
}
$stmt->execute();
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
$numrows = $stmt->rowCount();
if ($numrows == 0) {
?>
<html>
<head>
<link href=\"style_results.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />
</head>
<body>
<div id=\"contact\">
<h1>No results were returned from your search.</h1>
</div>
</body>
</html>
<?php
} else {
?>
<!DOCTYPE HTML>
<html>
<head>
<title> Marriage Database Modification </title>
<link href=\"style_mod.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />
<script type=\"text/javascript\" src=\"/js/modpage.js\"></script>
</head>
<body>
<div id=\"contact\">
<table border=\"2\" width=\"100%\">
<tr><td colspan=\"7\"><h1>Marriage Record Modifications</h2></td></tr>
<tr>
<td>
<table border=\"2\" width=\"100%\">
<div id=\"linkDiv\">
<tr><th>Last Name</th><th>First Name</th><th>Last Name</th><th>First Name</th><th>Month</th><th>Day</th><th>Year</th><th>Page</th><th>Source</th><th>Select</th></tr>
<?php for ($x=0;$x < $numrows;$x++) { ?>
<tr><td><?php echo $row[$x]['glast']?></td><td><?php echo $row[$x]['gfirst']?></td><td><?php echo $row[$x]['blast']?></td><td><?php echo $row[$x]['bfirst']?></td><td><?php echo $row[$x]['month']?></td><td><?php echo $row[$x]['day']?></td><td><?php echo $row[$x]['year']?></td><td><?php echo $row[$x]['page']?></td><td><?php echo $row[$x]['id']?></td><td><input type=\"button\" value=\"select\" onclick=\"showDiv('<?php echo $row[$x]['id']?>');return false\"></td></tr> <?php }?>
</div>
</table>
</td>
<td rowspan=\"6\" height=\"800px\" width=\"1000px\">
<?php for ($x=0;$x < $numrows;$x++) { ?>
<div id=\"divLinks\">
<div id=\"container<?php echo $row[$x]['id']?>\" style=\"display:none\">
<table border=\"2\">
<tr>
<td>
<!-- The 4 container content divs. -->
<label><?php echo $row[$x]['id']?></label>
<form method=\"POST\" action=\"showoutput.php\">
<table height=\"790px\" width=\"990px\">
<tr>
<td valign=\"top\"><label>Groom's Last name:</label></td>
<td><input name=\"glname\" type=\"text\" value=\"<?php echo $row[$x]['glast']?>\" placeholder=\"Last Name of Groom [Required]\"/></td>
<td valign=\"top\"><label>Groom's First name:</label></td>
<td><input name=\"gfname\" type=\"text\" value=\"<?php echo $row[$x]['gfirst']?>\" placeholder=\"First Name of Groom [Required]\"/></td>
</tr>
<tr>
<td valign=\"top\"><label>Bride's Last Name:</label></td>
<td><input name=\"blname\" type=\"text\" value=\"<?php echo $row[$x]['blast']?>\" placeholder=\"Last Name of Bride [Required]\"/></td>
<td valign=\"top\"><label>Bride's First Name:</label></td>
<td><input name=\"bfname\" type=\"text\" value=\"<?php echo $row[$x]['bfirst']?>\" placeholder=\"First Name of Bride [Required]\"/></td>
</tr>
<tr>
<td valign=\"top\"><label>Month:</label></td>
<td>
<select name=\"mon\">
<option selected=\"selected\" value=\"<?php echo $row[$x]['month']?>\"><?php echo $row[$x]['month']?></option>
<option value=\"Jan\">January</option>
<option value=\"Feb\">February</option>
<option value=\"Mar\">March</option>
<option value=\"Apr\">April</option>
<option value=\"May\">May</option>
<option value=\"Jun\">June</option>
<option value=\"Jul\">July</option>
<option value=\"Aug\">August</option>
<option value=\"Sep\">September</option>
<option value=\"Oct\">October</option>
<option value=\"Nov\">November</option>
<option value=\"Dec\">December</option>
</select>
</td>
<td valign=\"top\"><label>Day:</label></td>
<td><input name=\"da\" type=\"text\" value=\"<?php echo $row[$x]['day']?>\"placeholder=\"Day number here [Required]\"/></td>
</tr>
<tr>
<td valign=\"top\"><label>Year:</label></td>
<td><input name=\"yr\" type=\"text\" value=\"<?php echo $row[$x]['year']?>\"placeholder=\"4 digit year i.e. 1990 [Required]\"/></td>
<td valign=\"top\"><label>Page Number:</label></td>
<td><input name=\"page\" type=\"text\" value=\"<?php echo $row[$x]['page']?>\"placeholder=\"Page Number i.e. 4D [Required]\"/></td>
</tr>
<tr>
<td valign=\"top\"><label>Source:</label></td>
<td>
<select name=\"src\">
<option selected=\"selected\" value=\"<?php echo $row[$x]['source']?>\"><?php echo $row[$x]['source']?></option>
<option value=\"Greenville News\">Greenville News</option>
<option value=\"Greenville News\">Greenville News</option>
<option value=\"Greenville News\">Greenville News</option>
<option value=\"Greenville News\">Greenville News</option>
<option value=\"Greenville News\">Greenville News</option>
<option value=\"Greenville News\">Greenville News</option>
<option value=\"Greenville News\">Greenville News</option>
<option value=\"Greenville News\">Greenville News</option>
<option value=\"Greenville News\">Greenville News</option>
</select>
</td>
</tr>
<tr>
<td colspan=\"2\"><input type=\"submit\" name=\"mod\" value=\"Modify Record\"></td>
<td colspan=\"2\"><input type=\"submit\" name=\"del\" value=\"Delete Record\"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div>
</div>
<?php } ?>
</td>
</tr>
</table>
</div>
</body>
</html>
<?php } ?>
// SNIPPET:
function
// SNIPPET:
Shark
// SNIPPET:
myShark.constructor.name
// SNIPPET:
constructor
// SNIPPET:
Shark
// SNIPPET:
// Fish
function Fish() {
this.fins;
}
Fish.prototype.swim = function() {
console.log(\"Swim\");
};
// Shark
function Shark() {
this.teeth;
}
Shark.prototype = new Fish;
Shark.prototype.constructor = Shark;
var myShark = new Shark();
console.log(\"My shark is: \" + myShark.constructor.name);
// Prints => My shark is: Shark
// SNIPPET:
Yacht
// SNIPPET:
myBoat.constructor.name
// SNIPPET:
String
// SNIPPET:
var boats = (function() {
exports = {};
// Boat
exports.Boat = function() {
this.crew = 1;
};
exports.Boat.prototype.sail = function() {
console.log(\"Sail\");
};
// Yacht
exports.Yacht = function() {
this.decks = 4;
};
exports.Yacht.prototype = new exports.Boat;
exports.Yacht.prototype.constructor = exports.Yacht;
return exports;
}());
var myYacht = new boats.Yacht();
console.log(\"My boat is: \" + myYacht.constructor.name);
// Prints => My boat is:
// SNIPPET:
exports
// SNIPPET:
var drinks = (function() {
var exports = {};
// Drink
function Drink() {
this.calories = 130;
}
// Beer
function Beer() {
this.alcohol = 8;
}
Beer.prototype = new Drink;
Beer.prototype.constructor = Beer;
exports.Drink = Drink;
exports.Beer = Beer;
return exports;
}());
var myBeer = new drinks.Beer();
console.log(\"My drink is: \" + myBeer.constructor.name);
// Prints => My drink is: Beer
// SNIPPET:
var dataURL = canvas.toDataURL('image/jpeg');
document.getElementById('canvasImg').src = dataURL;
// SNIPPET:
var http = require('http');
http.globalAgent.maxSockets = 200;
var url = require('url');
var instance = require('./build/Release/ret');
http.createServer( function(req, res){
var path = url.parse(req.url).pathname;
console.log(\"<req>\"+path+\"</req>\");
switch (path){
case ('/test'):
var body = [];
req.on('data', function (chunk) {
body.push(chunk);
});
req.on('end', function () {
body = Buffer.concat(body);
console.log(\"
// SNIPPET:
req received
// SNIPPET:
\");
console.log(Date.now());
console.log(\"
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
\");
instance.get(function(result){
postHTTP(result, res);
});
});
break;
}
}).listen(9999);
// SNIPPET:
std::string ret2 (){
sleep(1);
return string(\"{\\\"image\\\":\\\"1.JPG\\\"}\");
}
Handle<Value> getInfo(const Arguments &args) {
HandleScope scope;
if(args.Length() == 0 || !args[0]->IsFunction())
return ThrowException(Exception::Error(String::New(\"Error\")));
Persistent<Function> fn = Persistent<Function>::New(Handle<Function>::Cast(args[0]));
Local<Value> objRet[1] = {
String::New(ret2().c_str())
};
Handle<Value> ret = fn->Call(Context::GetCurrent()->Global(), 1, objRet);
return scope.Close(Undefined());
// SNIPPET:
for i in {1..3}; do time curl --request POST --data-binary \"@/home/user/Pictures/129762.jpg\" http://192.160.0.1:9999/test & done
// SNIPPET:
<req>/test</req>
// SNIPPET:
req received
// SNIPPET:
1397569891165
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
<req>/test</req>
// SNIPPET:
req received
// SNIPPET:
1397569892175
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
<req>/test</req>
// SNIPPET:
req received
// SNIPPET:
1397569893181
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
\"1.JPG\"
real 0m1.024s
user 0m0.004s
sys 0m0.009s
\"1.JPG\"
real 0m2.033s
user 0m0.000s
sys 0m0.012s
\"1.JPG\"
real 0m3.036s
user 0m0.013s
sys 0m0.001s
// SNIPPET:
<form id=\"login\" class=\"ui-body ui-body-a ui-corner-all\" data-ajax=\"false\" method=\"post\" >
<fieldset>
<div data-role=\"fieldcontain\">
<label for=\"username\">Usuario :</label>
<input type=\"text\" value=\"\" name=\"username\" id=\"username\"/>
</div>
<div data-role=\"fieldcontain\">
<label for=\"password\">Contraseña:</label>
<input type=\"password\" value=\"\" name=\"password\" id=\"password\"/>
</div>
<input type=\"submit\" data-theme=\"b\" name=\"submit\" id=\"submit\" value=\"Login\">
</fieldset>
</form>
// SNIPPET:
$(\"#login\").submit(function(){
alert(\"OK\");
}
// SNIPPET:
Object.observe()
// SNIPPET:
hidden
// SNIPPET:
title
// SNIPPET:
draggable
// SNIPPET:
*Changed
// SNIPPET:
hidden
// SNIPPET:
hiddenChanged()
// SNIPPET:
attributeChanged()
// SNIPPET:
attributeChanged: function(attrName, oldVal, newVal) {
// Cannot use *Changed watchers for these native properties.
if (attrName == 'hidden') {
this.marker.setVisible(!this.hidden);
}
}
// SNIPPET:
<a href=\"javascript:changeFreq()\">Anchor 1</a>
<a href=\"javascript:changeFreq()\">Anchor 2</a>
<a href=\"javascript:changeFreq()\">Anchor 3</a>
// SNIPPET:
changeFreq
// SNIPPET:
this
// SNIPPET:
window
// SNIPPET:
onclick
// SNIPPET:
POST /me/binders?access_token=U1kwMQAAAUV03fjJAACowFVKRnpSbjNvWHlNS2lOTnIwdEt3UzI4AAAAAVRnRjBEN0MzdURUQ2c5OHJMQWQwb0I2YXBpZ2VlMiAgIFB HTTP/1.1
X-HostCommonName:
api.moxtra.com
Host:
api.moxtra.com
Content-Length:
33
X-Target-URI:
https://api.moxtra.com
Content-Type:
application/json
Connection:
Keep-Alive
{
\"name\": \"My First Binder\"
}
// SNIPPET:
function pollStatus(url){
$.get(url, function(response){
if (response.uploaded === null){
setTimeout(pollStatus(url), 5000);
}
};
}
// SNIPPET:
800px
// SNIPPET:
function init() {
$.fn.scrollPath(\"getPath\").moveTo(400, 300, {
name: \"start\"
}).lineTo(400, 800, {
callback: function () {
highlight($(\".description\"));
alert(\"you have reached description\")
},
name: \"description\"
}).lineTo(400, 1600, {
callback: function () {
highlight($(\".settings\"))
},
name: \"syntax\"
}).lineTo(1750, 1600, {
callback: function () {
highlight($(\".sp-scroll-handle\"))
},
name: \"scrollbar\"
}).lineTo(2400, 2750, {
callback: function () {
highlight($(\".source\"));
alert(\"you have reached source\")
},
name: \"source\"
}).moveTo(2400, 2750, {
name: \"bitch\"
}).lineTo(6950, 2750, {
callback: function () {
highlight($(\".follow\"))
},
name: \"follow\"
}).lineTo(6950, 4750, {
name: \"end\"
})
}
// SNIPPET:
paper.setStart();
// draw draw draw
var set = paper.setFinish();
// SNIPPET:
var degree = 0;
function rotateSet() {
degree = degree + 90;
set.animate({ transform: [\"R\", degree, canvasCenter, canvasCenter]}, 500 );
}
// SNIPPET:
+function(){}
// SNIPPET:
$.fn.tooltip.prototype.getCalculatedOffset
// SNIPPET:
['international', 'splint', 'tinder']
// SNIPPET:
editable: true,
editmode: 'programmatic'
// SNIPPET:
beginrowedit
// SNIPPET:
a.preventDefault(href='javascript:window.open(\"https://twitter.com/intent/tweet?original_referer={{url}}&url={{url}}\", \"_blank\", \"width=400,height=500\");void(0);') Twitter
// SNIPPET:
<a href=\"unsafe:javascript:window.open(&quot;https://twitter.com/intent/tweet?original_referer=&amp;url=&quot;, &quot;_blank&quot;, &quot;width=400,height=500&quot;);void(0);\" class=\"preventDefault\">Twitter</a>
// SNIPPET:
var allQuestions = [{
\"question\": \"Who was Luke's wingman in the battle at Hoth?\",
\"choices\": [\"Dak\", \"Biggs\", \"Wedge\", \"fx-7\"],
\"correctAnswer\": 0},
{
\"question\": \"What is the registry of the Starship Reliant?\",
\"choices\": [ \"NX-01\", \"NCC-1864\", \"NCC-1701\", \"NCC-2000\"],
\"correctAnswer\": 1}...etc.
// SNIPPET:
var output = '';
for (key in allQuestions[0]) {
output += '<li>' + allQuestions[0] + '</li>';
}
var update = document.getElementById(\"question\");
update.innerHTML = output;
// SNIPPET:
[object Object]
[object Object]
[object Object]
// SNIPPET:
<h2>question</h2> //question from object
<ul id=\"question\">
<li>choice</li> //choice from object
<li>choice</li>
<li>choice</li>
<li>choice</li>
// SNIPPET:
[{\"ID\":\"001\",\"name\":\"Naidu\",\"school\":\"Hyd\",\"hobby\":\"cricket\"}]
// SNIPPET:
$.ajax({ url: 'http://something.com/api/name',
data:{},
type: 'post',
dataType: \"json\",
success: function(output) {
//alert(\"SUCCESS\");
alert(output);
}});
// SNIPPET:
@Html.PagedListPager(Model , page => Url.Action(\"Index\",\"Server\", new {searchTerm = ViewBag.searchTerm , page,sort = ViewBag.CurrentSortOrder, pagesize = $(\"#pagesize\").val() }),
PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(PagedListRenderOptions.ClassicPlusFirstAndLast, new AjaxOptions { UpdateTargetId = \"ServerTable\" , LoadingElementId=\"progress2\" }))
// SNIPPET:
$(\"#pagesize\").val()
// SNIPPET:
<head>
<meta charset=\"utf-8\" />
<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />
<link href=\"../Content/bootstrap.css\" rel=\"stylesheet\" />
</head>
<nav class=\"navbar navbar-default\" id=\"navbar\" role=\"navigation\">
<div class=\"navbar-header\">
<button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\"#navbar-collapse-1\">
<span class=\"sr-only\">Toggle navigation</span>
<span class=\"icon-bar\"></span>
<span class=\"icon-bar\"></span>
<span class=\"icon-bar\"></span>
</button>
<a class=\"navbar-brand\" href=\"/Home.aspx\">
<img src=\"\" class=\"img-responsive\" alt=\"logo\" />
</a>
</div>
<div class=\"collapse navbar-collapse\" id=\"navbar-collapse-1\">
<ul class=\"nav navbar-nav\">
<li><a href=\"../Home.aspx\">Home</a></li>
<li class=\"dropdown\">
<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">Products & Services <b class=\"caret\"></b></a>
<ul class=\"dropdown-menu\">
<li><a tabindex=\"-1\" href=\"\">Workflow</a></li>
<li><a tabindex=\"-1\" href=\"\">Sys</a></li>
<li></li>
<li class=\"dropdown-submenu\"><a tabindex=\"-1\" href=\"#\">App</a>
<ul class=\"dropdown-menu\">
<li><a tabindex=\"-1\" href=\"\">Overview</a></li>
<li><a tabindex=\"-1\" href=\"\">Pricing</a></li>
<li><a tabindex=\"-1\" href=\"\">Demo</a></li>
</ul>
</li>
</ul>
</li>
<li><a href=\"\">Contact</a></li>
</ul>
</div>
</nav>
// SNIPPET:
jQuery.each(function(index) { ... });
jQuery.each(function(index, value) { ... });
// SNIPPET:
index
// SNIPPET:
index, value
// SNIPPET:
jQuery.ajax({url: \"test.jsp\", cache: false}).done(function( data ) { ... });
// SNIPPET:
url
// SNIPPET:
cache
// SNIPPET:
done
// SNIPPET:
height: 300px;
// SNIPPET:
overflow: auto;
// SNIPPET:
height
// SNIPPET:
function initialize() {
var chicago = new google.maps.LatLng(48.807,2.137);
var mapOptions = {
zoom: 11,
center: chicago
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var ctaLayer = new google.maps.KmlLayer({
url: '78.kml'
});
ctaLayer.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
// SNIPPET:
<script type=\"text/javascript\" src=\"http://geoxml3.googlecode.com/svn/branches/polys/geoxml3.js\"></script>
<script type=\"text/javascript\">
function initialize() {
var chicago = new google.maps.LatLng(48.807,2.137);
var mapOptions = {
zoom: 11,
center: chicago
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var myKmlOptions = {
preserveViewport: true,
suppressInfoWindows: true
}
var myParser = new geoXML3.parser({map: map});
myParser.parse('78.kml');
//var ctaLayer = new google.maps.KmlLayer(\"http://localhost/monDossier/78Yvelines.kml\",{color:\"#4385F1\" } );
//ctaLayer.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
// SNIPPET:
function Pizza() {
var aSlice = new PizzaSlice();
this.extras = [];
this.addPaproni = function() {
this.extras.push(\"paproni\");
}
}
// SNIPPET:
function PizzaSlice() { }
// SNIPPET:
news_divs[i].innerHTML= content.substr(0,this.config.head_length)+\"...<div style='display:none'>\"+content+\"</div>\";
news_divs[i].onclick = function(){var child=this.getElementByTagName('div')[0];child.style=\"display:block;\"}
// SNIPPET:
Uncaught TypeError: undefined is not a function news_div.js:9
news_divs.(anonymous function).onclick
// SNIPPET:
news_divs[i].onclick = function(){var child=this.firstChild;child.style=\"display:block;
// SNIPPET:
news_divs[i].onclick = function(){var child=this.children[0];child.style=\"display:block;
// SNIPPET:
news_divs[i].onclick = function(){console.log('test')}
// SNIPPET:
news_div
// SNIPPET:
context.globalAlpha=1;
context.strokeStyle=\"#000\";
context.beginPath();
/* draw the grid */
context.stroke();
context.closePath;
// SNIPPET:
<script type=\"text/javascript\">
function confirm_submit()
{
var con = confirm(\"Submit form and print invoice?\");
var url = 'dashboard.php?del=no';
if (con == true) {
document.location.href = url;
/*I have also tried:
window.location = 'dashboard.php?del=no';
window.location.replace(\"dashboard.php?del=no\");
window.location.href = \"dashboard.php?del=no\";
*/
}
else {
return false;
}
}
</script>
// SNIPPET:
onclick=\"return(confirm_submit())\"
// SNIPPET:
simperiumBucket.make
// SNIPPET:
this.make
// SNIPPET:
service('simperiumBucket', function($localStorage, $rootScope, simperiumCred){
$rootScope.$on('authSuccess', function(scope,response){
simperiumBucket.make('first')
});
return{
make: function(name){
//here is the code i wish to run
}
}
}).
// SNIPPET:
<script type='text/javascript' src=\"http://www.someurl.com/datepicker/js/bootstrap-datepicker.js\"></script>
// SNIPPET:
SyntaxError: Unexpected token <
// SNIPPET:
<div id=\"Todo\">
<p class=\"items\">
<h1>Title</h1>
<span class=\"task\">Task</span>
</p>
</div>
// SNIPPET:
#Todo
// SNIPPET:
$el = $('#Todo')
// SNIPPET:
#Todo
// SNIPPET:
$('#Todo').children('.items')
// SNIPPET:
.find()
// SNIPPET:
{
\"background\":{
\"scripts\":[\"background.js\"]
},
\"permissions\":[\"tabs\"],
\"browser_action\": {
\"default_icon\": \"img/icone.png\",
\"default_title\": \"displayer.\"
},
\"icons\" : {
\"128\" : \"img/icone_128.png\",
\"48\" : \"img/icone_48.png\",
\"32\" : \"img/icone_32.png\",
\"24\" : \"img/icone_24.png\",
\"16\" : \"img/icone_16.png\"
},
\"manifest_version\": 2,
\"name\": \"displayer.\",
\"description\": \"This extension helps you to compare your wireframe with your current coded page..\",
\"version\": \"1.0.1\"
}
// SNIPPET:
chrome.browserAction.onClicked.addListener(function (tab) { //Fired when User Clicks ICON
if (tab.url.indexOf(\"http://*/*, https://*/*, file://*/*\") != -1) { // Inspect whether the place where user clicked matches with our list of URL
chrome.tabs.executeScript(tab.id,
{\"file\": \"contentscript.js\"},
function () { // Execute your code
console.log(\"Script Executed .. \"); // Notification on Completion
});
chrome.tabs.insertCSS(null, {file: \"grid.css\"});
}
});
// SNIPPET:
var A = [['n','sqrt(n)']]; // initialize array of rows with header row as 1st item
for(var j=1;j<10;++j){ A.push([j, Math.sqrt(j)]) }
var csvRows = [];
for(var i=0,l=A.length; i<l; ++i){
csvRows.push(A[i].join(',')); // unquoted CSV row
}
var csvString = csvRows.join(\"\\n\");
var a = document.createElement('a');
a.href = 'data:text/csv;charset=utf-8;base64,' + window.btoa(csvString);
a.target = '_blank';
a.download = 'myFile.csv';
document.body.appendChild(a);
a.click();
// SNIPPET:
<input type=\"text\" class=\"input-text required-entry\" value=\"1 High Street\" id=\"billing:street1\" name=\"billing[street][]\" title=\"Street Address\">
// SNIPPET:
jQuery('#billing:street1').val();
// SNIPPET:
#sbox {
overflow: hidden;
width: 200px;
}
// SNIPPET:
<select id=\"sbox\" name=\"selectbox\" size=\"5\"></select>
<BR>
<button type=\"button\" class=\"btn btn-default\" onclick=\"DeleteProbs();\">Delete Selected Problem</button>
</td>
</tr>
<tr>
<td colspan=\"2\" valign=\"top\"><p>To add a problem to the list, type it in the New Problem text field and then click &quot;Add to List&quot;. To remove a problem, click it in the list, then click, &quot;Delete Selected Problem&quot;<P>
<strong>New Problem</strong><P>
<input type=\"text\" id=\"ProbAreaFrom\">
<P>
<button type=\"button\" class=\"btn btn-default\" id=\"ProbListBtn\" onclick=\"ListProbs();\">Add to List</button>
</p>
Problem being detailed:<BR>
<select name=\"select\" id=\"dbox\">
</select>
// SNIPPET:
function ListProbs() {
var x = document.getElementById(\"sbox\");
var txt1 = document.getElementById(\"ProbAreaFrom\").value;
var option = document.createElement(\"option\");
option.text = txt1
x.add(option);
ListProbs2();
}
function ListProbs2() {
var y = document.getElementById(\"dbox\");
var txt1 = document.getElementById(\"ProbAreaFrom\").value;
var option = document.createElement(\"option\");
option.text = txt1
y.add(option);
ProbAreaFrom.value=\"\";
}
function DeleteProbs() {
var x = document.getElementById(\"sbox\");
for (var i = 0; i < x.options.length; i++) {
if (x.options[i].selected) {
x.options[i].remove();
}
}
}
// SNIPPET:
@Entity
@Table(name=\"APLICACAO\")
public class Aplicacao implements Serializable, Entidade {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name=\"CD_APLICACAO\")
private Long codigo;
@Column(name=\"NM_APLICACAO\")
@NotNull
private String nome;
@ManyToOne
@JoinColumn(name=\"CD_GRUPO\")
private GrupoAplicacao grupoAplicacao;
....
}
// SNIPPET:
@Entity
@Table(name = \"GRUPO_APLICACAO\")
public class GrupoAplicacao implements Serializable, Entidade {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = \"CD_GRUPO\")
private Long codigo;
@Column(name = \"NM_GRUPO\")
@NotNull
private String nome;
@OneToMany(mappedBy = \"grupoAplicacao\",fetch=FetchType.EAGER)
private List<Aplicacao> listaAplicacao;
@OneToMany(mappedBy = \"grupoAplicacao\",fetch=FetchType.EAGER)
private List<GrupoAplicacaoUsuario> listaGrupoAplicacaoUsuario;
....
}
// SNIPPET:
<div class=\"col-xs-12\" ng-controller=\"aplicacoesCreateController\">
<form class=\"form-horizontal form-medium center\" role=\"form\" name=\"form\" ng-submit=\"save()\">
<div class=\"form-group\">
<label for=\"nome\" class=\"col-xs-4 control-label\">Nome</label>
<div class=\"col-xs-8\">
<input type=\"text\" class=\"form-control input-sm\" id=\"nome\" placeholder=\"Nome\" required ng-model=\"aplicacao.nome\">
</div>
</div>
<div class=\"form-group\">
<label for=\"nome\" class=\"col-xs-4 control-label\">Nome</label>
<div class=\"col-xs-8\">
<select class=\"form-control\" required ng-model=\"aplicacao.grupoAplicacao\">
<option ng-repeat=\"grupo in grupos\" value=\"{{ grupo }}\">
{{ grupo.nome }}
</option>
</select>
</div>
</div>
<div class=\"form-group\">
<div class=\"col-xs-offset-4 col-xs-8\">
<button type=\"submit\" class=\"btn btn-lg btn-size-md\">Salvar</button>
</div>
</div>
</form>
</div>
// SNIPPET:
app.controller('aplicacoesCreateController', ['$scope','aplicacoesService','$location','reloadService','gruposService',
function ($scope,aplicacoesService,$location,reloadService,gruposService) {
$scope.grupos = gruposService.list();
$scope.save = function () {
aplicacoesService.create($scope.aplicacao);
reloadService.on('#/aplicacoes');
};
}]);
// SNIPPET:
app.factory('gruposService', ['$resource', function ($resource) {
return $resource('resources/grupo-aplicacao', {}, {
'list': { method: 'GET', isArray: true }
});
}]);
// SNIPPET:
app.factory('aplicacoesService', ['$resource', function ($resource) {
return $resource('resources/aplicacao', {}, {
'list': { method: 'GET', isArray: true },
'create': { method: 'POST' }
});
}]);
// SNIPPET:
Caused by: org.codehaus.jackson.map.JsonMappingException: Can not instantiate value of type [simple type, class br.com.techpeople.grape.entity.GrupoAplicacao] from JSON String; no single-String constructor/factory method (through reference chain: br.com.techpeople.grape.entity.Aplicacao[\"grupoAplicacao\"])
// SNIPPET:
if (datePhp>today){
var difference=(datePhp.getTime()-today.getTime())/1000;
days=Math.floor(difference/86400);
difference=difference-(86400*days);
if(days==1){
sumeDays=days*24;
}
hours=Math.floor(difference/3600);
printHours=Math.floor(difference/3600)+sumeDays;
difference=difference-(3600*hours);
minutes=Math.floor(difference/60);
difference=difference-(60*minutes);
seconds=Math.floor(difference);`
$(\"#counter\" + counter).html(printHours + ' Hours ' + minutes + ' Minutes ' + seconds + ' Seconds');
if (days>0 || hours>0 || minutes>0 || seconds>0){
setTimeout(\"countdown(\"+counter+\", \"+year+\",\"+month+\",\"+day+\",\"+hour+\",\"+minute+\",\"+second+\")\",1000)
}
// SNIPPET:
<div id='counter<?php echo $i ?>'></div>
<script type=\"text/javascript\">
countdown(<?php echo $i?>, <?php echo $year?>, <?php echo $month?>, <?php echo $day?>, <? php echo $hour?>, <?php echo $minute?>, <?php echo $second?>);
</script>
// SNIPPET:
<form role=\"form\" action=\"continue.php\" method=\"post\" id=\"durationForm\">
<tr>
<td colspan = \"3\">Please enter the duration?</td>
</tr>
<tr>
<td width=\"10%\"><input type=\"number\" class=\"form-control\" id=\"duration\" name=\"durationNumber\" required></td>
<label for=\"duration\" class=\"validateError\"></label>
<td width=\"50%\">
<div class=\"controls\">
<label class=\"radio\">
<input type=\"radio\" name=\"duration\" id=\"duration\" value=\"Hours\" required> Hours</label>
<label class=\"radio\">
<input type=\"radio\" name=\"duration\" id=\"duration\" value=\"Days\" required> Days</label>
<label class=\"radio\">
<input type=\"radio\" name=\"duration\" id=\"duration\" value=\"Unsure\" required> Unsure</label>
<label for=\"duration\" class=\"validateError\"></label>
</div>
</td>
</tr>
<button type=\"submit\" class=\"btn btn-primary\">Next</button>
</form>
// SNIPPET:
$(document).ready(function () {
$(\"#durationForm\").validate({
errorClass: \"validateError\"
});
});
// SNIPPET:
var moduleName = {
prop1 : 'value1',
prop2 : 'value2',
fun1Name : function () {
// body of funName
moduleName.fun2Name(); // notice the way I am calling the function using moduleName
// Didn't use this.fun2Name()
},
fun2Name : function () {
// body of functName
}
};
// SNIPPET:
moduleName.functionName()
// SNIPPET:
this.functionName()
// SNIPPET:
moduleName.functionName()
// SNIPPET:
this.functionName()
// SNIPPET:
#sideBarWrapper
// SNIPPET:
(function (exocet, $, undefined) {
// Distance of sidebar from document top
function sideBarTop () {
return $eventSideBar.offset().top;
}
// Distance user has scrolled
function scrollDist () {
return $(window).scrollTop();
}
// Toggle sidebar class
function sideBarStick(sbt) {
if (sbt-30 < scrollDist()) {
$sideBarWrapper.addClass('fix');
} else{
$sideBarWrapper.removeClass('fix');
}
}
// Scroll events
function scroll() {
$eventSideBar = $('#eventSideBar');
$sideBarWrapper = $('#sideBarWrapper');
var sbt = sideBarTop();
return $(window).scroll(function () {
sideBarStick(sbt);
});
}
exocet.init = function () {
scroll();
};
}(window.exocet = window.exocet || {}, jQuery));
// SNIPPET:
$(function() {
exocet.init();
});
// SNIPPET:
wpApp = angular.module('wpApp', ['ngRoute']);
wpApp.controller(\"ctrlr\", function($scope) {
$scope.message = 'This is the page';
});
// SNIPPET:
describe(\"A suite\", function() {
var scope;
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
$controller(\"controller\", {
$scope: scope
});
}));
it(\"should have the default message\", function() {
return expect(scope.message).toBe('This is the page');
});
});
// SNIPPET:
<script type=\"text/javascript\">
var counter = 2;
$(document).ready(function () {
$(\"#addButton\").click(function () {
if (counter > 3) {
alert(\"Limit Exceeds\");
return false;
}
var $wrap = $('#TextBoxesGroup');
var dynamichtml = '<div id=\"div' + counter + '\"><div class=\"mcity\"><label> Leaving from</label><input type=\"text\" name=\"textbox' + counter + '\" id=\"textbox' + counter + '\" class=\"auto\"/> </div><div class=\"mcity\"> <label> Going to</label> <input type=\"text\" name=\"textbox' + counter + '\" id=\"textbox' + counter + 1 + '\" class=\"auto\"/> </div><div class=\"mcity\"> <label> Going to</label> <input type=\"text\" name=\"textbox' + counter + '\" id=\"textbox' + counter + 11 + '\" class=\"auto\"/> </div>';
$wrap.append(dynamichtml);
counter++;
});
$(\"#removeButton\").click(function () {
if (counter == 1) {
alert(\"No more textbox to remove\");
return false;
}
counter--;
$(\"#TextBoxesGroup\").find(\"#div\"+ counter).remove();
// $(\"#TextBoxesGroup\").find(\"#textbox\" + counter+1).remove();
});
$(\".auto\").live(\"focus\", function () {
$(this).autocomplete({
source: function (request, response) {
var textval = request.term; // $(this).val();
$.ajax({
type: \"POST\",
contentType: \"application/json; charset=utf-8\",
url: \"Home.aspx/GetAutoCompleteData\",
data: \"{'code':'\" + textval + \"'}\",
dataType: \"json\",
success: function (data) {
response(data.d);
},
error: function (result) {
alert(\"Error\");
}
});
}
});
});
});
</script>
// SNIPPET:
<script type=\"text/javascript\">
$(function () {
$(\"#btnPost\").bind(\"click\", function () {
//Create a Form
var $form = $(\"<form/>\").attr(\"id\", \"data_form\")
.attr(\"action\", \"Complete.aspx\")
.attr(\"method\", \"post\");
$(\"body\").append($form);
//Append the values to be send
AddParameter($form, \"txtleft\", $(\"#txtSearchleft\").val());
AddParameter($form, \"txtright\", $(\"#txtSearchright\").val());
//Send the Form
$form[0].submit();
});
});
function AddParameter(form, name, value) {
var $input = $(\"<input />\").attr(\"type\", \"hidden\")
.attr(\"name\", name)
.attr(\"value\", value);
form.append($input);
}
</script>
// SNIPPET:
<div class=\"cycle-slideshow\" id=\"cycle-1\" style=\"float:left;\"
data-cycle-fx=scrollHorz
data-cycle-timeout=3000 >
<img src=\"./responsive/img/java1.gif\">
<img src=\"./responsive/img/java2.gif\">
<img id=\"trigger\" src=\"./responsive/img/clown.gif\">
<img src=\"./responsive/img/java4.gif\">
</div>
<div id=\"target\" style=\"position:absolute;top:50px;left:350px\">
<img src=\"./responsive/img/java5.gif\">
</div>
// SNIPPET:
Car
// SNIPPET:
Drives
// SNIPPET:
Res
// SNIPPET:
Failed to create new myRes, with error code: undefined
// SNIPPET:
myDrive
// SNIPPET:
myRes
// SNIPPET:
console.log(\"Starting\");
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// PARSE Classes!
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var Parse = require('parse').Parse;
var parse_JSKey = \"xxx\";
var parse_AppKey = \"xxx\";
Parse.initialize(parse_AppKey, parse_JSKey);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// PARSE Classes!
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var Drives = Parse.Object.extend(\"Drives\");
var StaSto = Parse.Object.extend(\"StaSto\");
var Res = Parse.Object.extend(\"Res\");
var Car = Parse.Object.extend(\"Car\");
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// fake data
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var myDriveData = {'distance':21, 'speed': 99};
var carID = \"mrNQcPRNl4\"; //already in parse.com!
var myStaSto_lat = 48.1333;
var myStaSto_lng = 11.5667;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// insert into parse
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// SNIPPET:
query for the car
var carQuery = new Parse.Query(Car);
carQuery.get(carID, {
success: function(result) {
var thisCar = result;
//
// SNIPPET:
create a new drive
var myDrive = new Drives(); // created a new object, but empty
myDrive.set('distance', myDriveData.distance);
myDrive.set('speed', myDriveData.speed);
//
// SNIPPET:
create a new StaSto
var myStaSto = new StaSto();
myStaSto.set('coord',new Parse.GeoPoint({latitude: myStaSto_lat, longitude: myStaSto_lng}));
myStaSto.set('drive',myDrive);
//
// SNIPPET:
create a new Res
var myRes = new Res();
myRes.set('drive',myDrive);
myRes.set('car',thisCar);
myRes.set('res',717);
console.log(myRes);
//
// SNIPPET:
// SNIPPET:
-> save them all
myRes.save(null, {
success: function(response) {
// Execute any logic that should take place after the object is saved.
console.log('saved myRes succesfully');
myStaSto.save(null,{
success: function(response){
console.log('saved myStaSto succesfully');
myDrive.save(null,{
success: function(response){
console.log('saved myDrive succesfully');
},
error: function(response,error){
console.log('Failed to create new myDrive, with error code: ' + error.description);
}
}); // end of myDrive.save
},
error: function(response,error){
console.log('Failed to create new myStaSto, with error code: ' + error.description);
}
}); // end of myStaSto save
},
error: function(response, error) {
// Execute any logic that should take place if the save fails.
// error is a Parse.Error with an error code and description.
console.log('Failed to create new myRes, with error code: ' + error.description);
}
}); // end of myRes.save
},
error: function(object, error) {
console.log('error in car query: ' + error.code + \" \" + error.message);
}
}); // end of car query.
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// SNIPPET:
var LightBoxLogin = {
DialogBox: null,
SuccessFunction: null,
..........
Login: function(){
console.log(LightBoxLogin.SuccessFunction) // Displays \"TestSubmit()\"
LightBoxLogin.SuccessFunction(); // does nothing, should alert the page
}
}
// SNIPPET:
LightBoxLogin.SuccessFunction
// SNIPPET:
function SuperLightbox(functOnSuccess)
{
LightBoxLogin.SuccessFunction = functOnSuccess;
if(IsLightboxNeeded())
{
LightBoxLogin.Login();
}
else{
alert(\"Not needed\");
}
}
// SNIPPET:
function TestSubmitHandler ()
{
SuperLightbox(TestSubmit);
}
function TestSubmit ()
{
alert('TEST SUBMIT ALL CAPS');
}
// SNIPPET:
$(function () {
$(\"a[rel]\").overlay({
mask: 'lightgrey',
effect: 'apple',
onBeforeLoad: function () {
var wrap = this.getOverlay().find(\".contentWrap\");
wrap.load(this.getTrigger().attr(\"href\"));
}
});
});
// SNIPPET:
<style type=\"text/css\">
.modal .modal-body {
max-height: 420px;
overflow-y: auto;
}
</style>
// SNIPPET:
FF : <input class=\"select2-input\" type=\"text\" spellcheck=\"false\" autocapitalize=\"off\" autocorrect=\"off\" autocomplete=\"off\">
IE:<input class=\"select2-input select2-focused\" type=\"text\" jQuery111006508689540941444=\"114\" spellcheck=\"false\" autocapitalize=\"off\" autocorrect=\"off\" autocomplete=\"off\"/>
// SNIPPET:
jQuery.ajax({
url:
\"jenkins url that calls build\",
type: \"GET\",
beforeSend: function () {
},
complete: function () {
},
success: function () {
/** Give build 12 secs to finish. **/
setTimeout(function() {
jQuery.ajax({
url:
\"json url that stores the results of build\",
type: \"GET\",
beforeSend: function () {
},
complete: function () {
},
success: function (lastBuild) {
}
});
}, 12000);
}
});
// SNIPPET:
jQuery.ajax({
url:
\"jenkins url that calls build\",
type: \"GET\",
beforeSend: function () {
},
complete: function () {
},
success: function () {
var building = false;
// Freaks out here.
while (!building) {
jQuery.ajax({
url:
\"json url that stores the results of build\",
type: \"GET\",
beforeSend: function () {
},
complete: function () {
},
success: function (lastBuild) {
building = lastBuild[\"building\"];
}
});
}
});
// SNIPPET:
javascipt
// SNIPPET:
button
// SNIPPET:
function changeImage() {
if (document.GetElementById('flashlight').src == \"img\\flashlight.png\") {
image.src=\"img\\flashlightON.png\";
} else (document.GetElementById('flashlight').src == \"img\\flashlightON.png\"); {
image.src=\"img\\flashlight.png\";
}
}
// SNIPPET:
<button type=\"button\" onClick=\"changeImage()\" class=\"classname\"> </button>
// SNIPPET:
<select ng-model=\"user\" data-ng-options=\"user.Forename + ' ' + user.Surname for user in allusers\"></select>
// SNIPPET:
<input type=\"text\" value=\"{{ user.Surname }}\" />
<input type=\"text\" value=\"{{ user.Forename }}\" />
<input data-convert-json-date data-jsondate=\"{{ user.DOB }}\" />
// SNIPPET:
myApp.directive('convertJsonDate', function () {
return {
restrict: 'EAC',
link: function (scope, el, attrs) {
var JSONdate = attrs.jsondate;
var formattedDate = new Date(parseInt(JSONdate.substr(6)));
el.val(formattedDate.format(\"dd/mm/yyyy\"));
}
}
});
// SNIPPET:
nomer | user | count |
// SNIPPET:
// SNIPPET:
-|
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
|
// SNIPPET:
// SNIPPET:
-- |
1 |аОleg | 2 |
2 |Eugene Ghostishev | 1 |
| | |
// SNIPPET:
_Button.mousedown(function(){
// Do Stuff
});
// SNIPPET:
_Button.mousedown(function(){
// Do Stuff
});
if ( touchSreenFlag === true) {
_Button.mousedown(function(){
// Do Stuff
});
}
// SNIPPET:
<div id=\"scrollerFilter\">
<ul id=\"theListFilter\">
<li class=\"selected\">All</li>
<li><i>Industrial filter</i></li>
<li>bla 1</li>
<li>bla 2</li>
<li>bla 3</li>
.....
<li>bla 6235</li>
<li><i>Functional filter</i></li>
<li>bla 1</li>
<li>bla 2</li>
<li><i>Regional filter</i></li>
<li>bla 1</li>
<li>bla 2</li>
<li>bla 3</li>
<li>bla 4</li>
<li>bla 5</li>
<li>bla 6</li>
</ul>
</div>
// SNIPPET:
<div id=\"scrollerFilter\">
<ul id=\"theListFilter\" class=\"column1\">
<li><i>Industrial</i></li>
<li>bla 1</li>
<li>bla 2</li>
<li>bla 3</li>
.....
<li>bla 6235</li>
</ul>
<ul id=\"theListFilter\" class=\"column2\">
<li><i>Functional</i></li>
<li>bla 1</li>
<li>bla 2</li>
</ul>
<ul id=\"theListFilter\" class=\"column3\">
<li><i>Regional</i></li>
<li>bla 1</li>
<li>bla 2</li>
<li>bla 3</li>
<li>bla 4</li>
<li>bla 5</li>
<li>bla 6</li>
</ul>
</div>
// SNIPPET:
var total = $(\"#scrollerFilter li\").size();
var count = 4;
var column = 0;
for (var i = 0; i < total; i += count) {
column++;
$(\"#newDIV\").append('<ul id=\"columns' + column + '\"></ul>');
$(\"#columns\" + column).html($(\"#scrollerFilter li\").splice(0, count));
}
$(\"#scrollerFilter\").remove();
// SNIPPET:
.image-gallery .big-image a:target img {display:block;}
.image-gallery .big-image a:target ~ img#default {display:none; width:1px;}
.image-gallery .big-image img#default {display:block;}
// SNIPPET:
target
// SNIPPET:
a
// SNIPPET:
<div id=\"lead-slider\" class=\"owl-carousel oc-lead\">
<div class=\"lead-slide\"></div>
<div class=\"slide2\"></div>
<div class=\"slide3\"></div>
<div class=\"slide4\"></div>
<div class=\"slide5\"></div>
<div class=\"slide6\"></div>
<div class=\"slide7\"></div>
<div class=\"slide8\"></div>
</div><!-- END OWL CAROUSEL -->
// SNIPPET:
$(\"#lead-slider\").height($(window).height() ) ;
$(window).resize(function(){
$(\"#lead-slider\").height($(window).height() );
$(\".lead-slide\").height($(window).height() ) ;
$(window).resize(function(){
$(\".lead-slide\").height($(window).height() );
});
$(\".slide2\").height($(window).height() ) ;
$(window).resize(function(){
$(\".slide2\").height($(window).height() );
});
$(\".slide3\").height($(window).height() ) ;
$(window).resize(function(){
$(\".slide3\").height($(window).height() );
});
$(\".slide4\").height($(window).height() ) ;
$(window).resize(function(){
$(\".slide4\").height($(window).height() );
});
$(\".slide5\").height($(window).height() ) ;
$(window).resize(function(){
$(\".slide5\").height($(window).height() );
});
$(\".slide6\").height($(window).height() ) ;
$(window).resize(function(){
$(\".slide6\").height($(window).height() );
});
$(\".slide7\").height($(window).height() ) ;
$(window).resize(function(){
$(\".slide7\").height($(window).height() );
});
$(\".slide8\").height($(window).height() ) ;
$(window).resize(function(){
$(\".slide8\").height($(window).height() );
});
// SNIPPET:
$(\"#lead-slider\").owlCarousel({
autoPlay: 3000,
navigation : false, // Show next and prev buttons
slideSpeed : 500,
paginationSpeed : 400,
singleItem:true,
autoHeight : false
});
// SNIPPET:
.lead-slide {
background-image: url('../img/what-slide.jpg');
background-position: center bottom;
background-size: cover;
}
// SNIPPET:
function DefaultAddressErrorChangeNotAllowedMessage() {
alert(\"<?php echo Mage::helper('invent_general')->getDefaultAddressErrorChangeNotAllowedMessage();?>\");
return;
}
// SNIPPET:
DefaultAddressErrorChangeNotAllowedMessage()
// SNIPPET:
<?php echo Mage::helper('invent_general')->getDefaultAddressErrorChangeNotAllowedMessage();?>
// SNIPPET:
width
// SNIPPET:
height
// SNIPPET:
animVal
// SNIPPET:
value
// SNIPPET:
ratio = svg.width.animVal.value / svg.height.animVal.value;
// SNIPPET:
animVal
// SNIPPET:
unitType
// SNIPPET:
$.get(svg_url, function(data) {
// Get the SVG tag, ignore the rest
svg = $(data).find('svg')
.attr('id', 'SVG')
// Remove any invalid XML tags as per http://validator.w3.org
.removeAttr('xmlns:a')
[0];
on_load();
}, 'xml');
// SNIPPET:
svg
// SNIPPET:
componentWillMount: function () {
var newInput = [
{ \"classes\": \"soft-half push-half--bottom brand-bg--gray-dark brand-color--white\", \"title\": \"Text Input\" },
{ \"classes\": \"soft-half push-half--bottom brand-bg--gray-dark brand-color--white\", \"title\": \"Checkbox Input\" },
{ \"classes\": \"soft-half push-half--bottom brand-bg--gray-dark brand-color--white\", \"title\": \"Radio Input\" }
];
var newZones = [
[
{ \"classes\": \"soft-half push-half--bottom brand-bg--gray-dark brand-color--white\", \"title\": \"Radio Input\" },
{ \"classes\": \"soft-half push-half--bottom brand-bg--gray-dark brand-color--white\", \"title\": \"Text Input\" },
{ \"classes\": \"soft-half push-half--bottom brand-bg--gray-dark brand-color--white\", \"title\": \"Checkbox Input\" }
,{}
],
[
{ \"classes\": \"soft-half push-half--bottom brand-bg--gray-dark brand-color--white\", \"title\": \"Text Input\" },
{ \"classes\": \"soft-half push-half--bottom brand-bg--gray-dark brand-color--white\", \"title\": \"Checkbox Input\" }
,{}
]
];
this.setState({ inputs: newInput });
this.setState({ zones: newZones });
}
// SNIPPET:
$(this).hide();
// SNIPPET:
<img src='images/star-transparent.png' id='star_transparent-1' width='30' height='30' class='star_transparent' />
<img src='images/star-transparent.png' id='star_transparent-2' width='30' height='30' class='star_transparent' />
<img src='images/star-blue.png' id='star_blue-1' width='30' height='30' class='star_blue' />
<img src='images/star-blue.png' id='star_blue-2' width='30' height='30' class='star_blue' />
// SNIPPET:
$('.star_transparent').click(function() {
var star_id = $(this).attr('id');
$(this).hide();
//how to write the 'id' with 'class' in the following line
$('.star_blue').show();
});
// SNIPPET:
$(\"#star_transparent-1.star_transparent\");
or
$(\"#star_transparent-1 .star_transparent\");
// SNIPPET:
star_transparent-1
// SNIPPET:
star_transparent-2
// SNIPPET:
#star_transparent-1.star_transparent
// SNIPPET:
#star_transparent-1 .star_transparent
// SNIPPET:
$('input').on('keyup',function(){
this.value = this.value.replace(/[^0-9\\.]/g,'');
});
// SNIPPET:
<input type=\"number\">
// SNIPPET:
1234a
// SNIPPET:
<input type=\"text\">
// SNIPPET:
1234a
// SNIPPET:
1234
// SNIPPET:
<input type=\"tel\">
// SNIPPET:
<input type='file' id='input1'>
<img id='imagepreview1' src=\"http://placehold.it/100x100\" />
// SNIPPET:
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#imagepreview1').prop('src', e.target.result).show().addClass('selected');
}
reader.readAsDataURL(input.files[0]);
}
}
$(\"#input1\").change(function () {
readURL(this);
$('#imagepreview1').show();
});
var orig_src = $('#imagepreview1').prop('src');
$('#imagepreview1').click(function () {
$('#input1').replaceWith($('#input1').clone(true));
$('#imagepreview1').not('.selected').hide();
$('#imagepreview1.selected').prop('src', orig_src).removeClass('selected');
});
// SNIPPET:
// Class with prototype
function Foo(a) {
this.a = a;
}
Foo.prototype = {
bar: function () {
console.log(this.a);
}
};
f=new Foo(1)
f.constructor.name
\"Object\"
// Class with no prototype
function Fooee(a) {
this.a = a;
}
f1=new Fooee(1)
f1.constructor.name
\"Fooee\"
// SNIPPET:
<div id=\"stories\">
<div class=\"swapper\"><p>number 1</p></div>
<div class=\"swapper\"><p>number 2</p></div>
<div class=\"swapper\"><p>number 3</p></div>
</div>
// SNIPPET:
$(document).ready(function() {
$.fn.nextOrFirst = function(selector) {
var next = this.next(selector);
return (next.length) ? next : this.prevAll(selector).last();
};
setInterval(
function swap() {
$(\".swapper\").each(function() {
var nextItem = $(this).nextOrFirst();
$(this).html($(nextItem).html());
return;
});
}, 5000);
});
// SNIPPET:
<div id=\"smallImage\" style=\"display: block;\">
<img width=\"270\" height=\"270\" alt=\"Vitra\" name=\"large\" src=\"http://example.com/598441_m2.jpg\" style=\"display: block;\">
</div>
// SNIPPET:
<script>
var newImg = new Image();
newImg.src = \" ?? \";
</script>
// SNIPPET:
D3
// SNIPPET:
function fade(opacity) {
return function(d) {
node.style(\"stroke-opacity\", function(o) {
thisOpacity = isSameCluster(d, o) ? 1 : opacity;
this.setAttribute('fill-opacity', thisOpacity);
return thisOpacity;
});
};
};
function isSameCluster(a, b) {
return a.cluster == b.cluster;
};
// SNIPPET:
var node = svg.selectAll(\"circle\")
.data(nodes)
.enter()
.append(\"circle\")
.style(\"fill\", function(d, i) {
return \"url(#grad\" + i + \")\";
})
// .style(\"fill\", function(d) { return color(d.cluster); })
.call(force.drag)
.on(\"mouseover\", fade(.1))
.on(\"mouseout\", fade(1));
node.transition()
.duration(750)
.delay(function(d, i) { return i * 5; })
.attrTween(\"r\", function(d) {
var i = d3.interpolate(0, d.radius);
return function(t) { return d.radius = i(t); };
});
// SNIPPET:
<?php
$pfstatetext = get_mypfstate();
$cpuusage= cpu_usage();
?>
<div id=\"show\">
<canvas id=\"chart-area2\" width=\"300\" height=\"300\"/>
</div>
<script>
var pieData2 = [
{
value: <?= $pfstatetext;?>,
color:\"#F7464A\",
highlight: \"#FF5A5E\",
label: \"Red :\"
},
{
value: <?= $cpuusage; ?>,
color: \"#46BFBD\",
highlight: \"#5AD3D1\",
label: \"Green\"
}
];
window.onload = function(){
var ctx2 = document.getElementById(\"chart-area2\").getContext(\"2d\");
var myPie2 = new Chart(ctx2).Pie(pieData2);
var myVar=setInterval(function(){myTimer()},10000);
function myTimer() {
var ctx2 = document.getElementById(\"chart-area2\").getContext(\"2d\");
var myPie2 = new Chart(ctx2).Pie(pieData2);
}
};
</script>
// SNIPPET:
<!doctype html>
<html>
<head>
<meta charset=\"utf-8\">
<title>Untitled Document</title>
<script src=\"http://code.jquery.com/jquery-2.1.1.js\"></script>
<script type=\"text/javascript\" src=\"toggle.js\"></script>
</head>
<body>
<button>Select Destinations<img src=\"images/down-arrow.png\" width=\"20\" height=\"20\" alt=\"\" style=\"vertical-align:middle; padding-top: 0px;\"/></button>
<nav id=\"menu\">
<a href=\"#\">Philadelphia</a>
<a href=\"#\">United States of America</a>
<a href=\"#\">Philippines</a>
<a href=\"#\">Long Destinations Names</a>
<a href=\"#\">Some Destination</a>
<a href=\"#\">Australia</a>
</nav>
</body>
</html>
// SNIPPET:
img_arrow = '<img src=\"images/down-arrow.png\" width=\"20\" height=\"20\"/>';
$(function ()
{
var $window = $(window),
$nav = $('nav'),
$button = $('button');
$button.on('click', function ()
{
$nav.slideToggle();
});
$window.on('resize', function ()
{
if ($window.width() > 320)
{
$nav.show();
}
});
});
$('#menu a').click(function(e){
$('button').html($(this).html() + img_arrow);
e.preventDefault();
});
// SNIPPET:
render: function(options) {
this.ticketId = options.ticketId;
var that = this;
var ticketModel = new TicketModel({'id': that.ticketId});
$.when(ticketModel.fetch()).done(function(){
console.log(ticketModel); // this outputs the correct model
});
var template = _.template($('#tab-content-template').html(), {ticketId: that.ticketId});
this.$el.html(template);
},
// SNIPPET:
render: function(options) {
this.ticketId = options.ticketId;
var that = this;
var ticketModel = new TicketModel({'id': this.ticketId});
$.when(ticketModel.fetch()).done(function(){
console.log(ticketModel);
console.log($('#tab-content-template').html());
var template = _.template($('#tab-content-template').html(), {ticketId: that.ticketId});
this.$el.html(template);
});
},
// SNIPPET:
console.log($('#tab-content-template').html());
// SNIPPET:
this.$el.html(template);
// SNIPPET:
<div id=\"slide-1\">a</div>
<div id=\"slide-2\">b</div>
<div id=\"slide-3\">c</div>
<div id=\"slide-4\">d</div>
// SNIPPET:
$('div').height($(window).height());
// SNIPPET:
Error: [$injector:unpr] Unknown provider: $translateProvider <- $translate
// SNIPPET:
loadingCtrlSpec.js
define([
'angular',
'angular-mocks',
'app',
'angular-translate'
], function(angular, mocks, app) {
'use strict';
describe('loadingCtrl', function(){
var ctrl, scope, translate;
beforeEach(mocks.module('TestApp'));
beforeEach(inject(function($injector){
scope = $injector.get('$rootScope').$new();
translate = $injector.get('$translate');
}));
it(\"contains spec with an expectation\", function() {
expect(true).toBe(true);
});
});
});
// SNIPPET:
define(['angular'], function (angular) {
'use strict';
angular.module('TestApp', [])
.controller('loadingCtrl', ['$scope', '$translate', function($scope, $translate) {
$translate(['build.DEFAULT_EMAIL_SUBJECT','build.DEFAULT_EMAIL_NOTES']).then(function (translations) {
$scope.title = translations[\"build.DEFAULT_EMAIL_SUBJECT\"];
$scope.notes = translations[\"build.DEFAULT_EMAIL_NOTES\"];
});
}]); })
// SNIPPET:
$scope.fullCtrl.searchResults
// SNIPPET:
<body ng-app=\"myApp\" ng-controller=\"fullCtrl\">
<div class=\"row\">
<div class=\"col-sm-12 col-xs-12\">
<div id=\"map-canvas\"></div>
<p>{{ fullCtrl.searchResults }}</p> <!-- not updating -->
<!-- click twice and it updates -->
<button ng-click=\"searchPlaces()\">Search</button>
</div>
</div>
</body>
// SNIPPET:
myApp.factory('getWait', function ($http, $q) {
return {
getUrl: function(url, data) {
var deferred = $q.defer();
$http.get(url, data)
.success(function(rtn) {
deferred.resolve({
res: rtn
});
}).error(function(msg, code) {
deferred.reject(msg);
});
return deferred.promise;
}
}
});
myApp.controller(\"fullCtrl\", ['$scope', '$http', \"$window\", \"getWait\",
function ($scope, $http, $window, getWait) {
$scope.fullCtrl = {};
$scope.fullCtrl.userLOCip = [];
$scope.fullCtrl.searchResults = []; //declared here!
var infoWindow = new google.maps.InfoWindow();
var service;
var searchLoc;
getWait.getUrl('http://ipinfo.io/json').then(
function(data) {
$scope.fullCtrl.userLOCip = data.res.loc.split(',');
$scope.fullCtrl.userLOCip[0] = Number($scope.fullCtrl.userLOCip[0]);
$scope.fullCtrl.userLOCip[1] = Number($scope.fullCtrl.userLOCip[1]);
console.log($scope.fullCtrl.userLOCip);
// Google maps
var mapOptions = {
zoom: 10,
center: new google.maps.LatLng($scope.fullCtrl.userLOCip[0], $scope.fullCtrl.userLOCip[1]),
}
$scope.map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
service = new google.maps.places.PlacesService($scope.map);
searchLoc = new google.maps.LatLng($scope.fullCtrl.userLOCip[0],
$scope.fullCtrl.userLOCip[1]);
}
);
$scope.searchPlaces = function () {
var request = {
location: searchLoc,
radius: 8047, // 5 miles
types: ['store']
};
service.nearbySearch(request, callback);
}
var callback = function (results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
$scope.fullCtrl.searchResults.push(results[i].name); // UPDATED HERE!
createMarker(results[i]);
console.log(results[i].name);
}
}
}
var createMarker = function (place) {
var marker = new google.maps.Marker({
map: $scope.map,
position: place.geometry.location,
title: place.name
});
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(place.name);
infoWindow.open($scope.map, marker);
});
}
}]);
// SNIPPET:
<li class=\"dropdown\">
<a class=\"dropdown-toggle\" data-toggle=\"dropdown\" ui-sref=\"a\">a<span class=\"caret\"></span></a>
<ul class=\"dropdown-menu\">
<li><a ui-sref=\"a\">a</a></li>
<li><a ui-sref=\"b\">b</a></li>
<li><a ui-sref=\"c\">c</a></li>
<li><a ui-sref=\"d\">d</a></li>
<li><a ui-sref=\"e\">e</a></li>
<li><a ui-sref=\"f\">f</a></li>
<li><a ui-sref=\"g\">g</a></li>
<li><a ui-sref=\"h\">h</a></li>
<li><a ui-sref=\"i\">i</a></li>
<li><a ui-sref=\"j\">j</a></li>
<li><a ui-sref=\"k\">k</a></li>
</ul>
</li>
// SNIPPET:
[
'h1,h2',
'span,style'
]
// SNIPPET:
[
'h1 span',
'h1 style',
'h2 span',
'h2 style
]
// SNIPPET:
span h1
// SNIPPET:
style h2
// SNIPPET:
function mergeTagSegments(arr, i, s) {
i = i || 0;
s = s || '';
if(!arr[i]) { return s; }
var spl = arr[i].split(',');
for(var j in spl) {
s += spl[j] + mergeTagSegments(arr, i+1, s);
}
return s;
}
// SNIPPET:
_.each(collection.models, function (model) {
require(['application/views/' + model.get(\"className\")], function (view) {
view();
});
});
// SNIPPET:
var availableTags = [
'ActionScript|AppleScript|Asp',
'BASIC',
'Clojure|C++|C|COBOL|ColdFusion',
'Erlang',
'Fortran',
'Groovy',
'Haskell',
'Java|JavaScript',
'Lisp',
'Perl|PHP|Python',
'Ruby',
'Scala|Scheme',
];
// SNIPPET:
renderItem
// SNIPPET:
$('#tags').autocomplete({
source: availableTags,
search: function(event, ui) {
$('#wrapper').empty();
},
})
.data('autocomplete')._renderItem = function(ul, item) {
return $('<div class=\"element\"></div>')
.data('item.autocomplete', item)
var smallchoice = item.label.split('|');
$.each(smallchoice,function(j,smallchoice){
$option = '<a href=\"#\" >' + smallchoice+ '</a>'
})
.append($option)
.appendTo($('#wrapper'));
};
// SNIPPET:
<div ng-include=\"'views/main.html'\" ng-controller=\"MainCtrl\"></div>
// SNIPPET:
<div ng-view></div>
// SNIPPET:
angular .module('testApp', ['ngRoute'])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateURL:'views/main.html',
controller: 'MainCtrl'
})
.when('/adoption', {
templateURL: 'views/foo.html',
controller: 'fooCtrl'
})
.otherwise({
redirectTo: '/'
});
});
// SNIPPET:
<script src=\"http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular-route.js\"></script>
// SNIPPET:
$scope
// SNIPPET:
<fieldset client=\"156510\">
<legend>Client 156510</legend>
<!-- Form elements -->
</section>
</fieldset>
// SNIPPET:
angular.module(\"plunker\", [])
.controller(\"ClientCtrl\", function($scope) {})
.directive(\"client\", function() {
return {
restrict: \"A\",
scope: {
name: \"@name\",
client: \"=client\"
}
};
});
// SNIPPET:
ng-repeat
// SNIPPET:
<div class=\"wrapper-left\">
<div class=\"news-container\">
<div class=\"news-content\">
<p>Lorem ipsum dolor sit amet,</p>
<p>Lorem ipsum dolor sit amet,</p>
<p>Lorem ipsum dolor sit amet,</p>
<p>Lorem ipsum dolor sit amet,</p>
<p>Lorem ipsum dolor sit amet,</p>
<p>Lorem ipsum dolor sit amet,</p>
</div>
</div>
<a href=\"#\" id=\"up\">Up</a>
<a href=\"#\" id=\"down\">down</a>
</div>
<div class=\"wrapper-right\">
<div class=\"products-container\">
<div class=\"products-content\">
<p>Lorem ipsum dolor sit amet,</p>
<p>Lorem ipsum dolor sit amet,</p>
<p>Lorem ipsum dolor sit amet,</p>
<p>Lorem ipsum dolor sit amet,</p>
<p>Lorem ipsum dolor sit amet,</p>
<p>Lorem ipsum dolor sit amet,</p>
</div>
</div>
</div>
<a href=\"#\" id=\"up2\">Up</a>
<a href=\"#\" id=\"down2\">down</a>
// SNIPPET:
$(document).ready(function() {
if ($('.news-content, .products-content').height() > $('.news-container, .products-container').height()) {
$(\"#down, #down2\").hover(function () {
animateContent(\"down\");
}, function() { $('.news-content, .products-content').stop(); });
$(\"#up\").hover(function () {
animateContent(\"up\");
}, function() { $('.news-content, .products-content').stop(); });
}
});
function animateContent(direction) {
var animationOffset = $('.news-container, .products-container').height() - $('.news-content, .products-content').height();
if (direction == 'up') {
animationOffset = 0;
}
$('.news-content, .products-content').animate({ \"marginTop\": animationOffset + \"px\" }, \"1500\");
}
$('html').on('click','a.up, a.down, a.up2, a.down2',function(event){
event.preventDefault();
});
// SNIPPET:
params = {
key_a_1 : \"value_a_1\"
key b_1 : \"value_b_1\"
key_c_1 : \"value_c_1\"
key d_1 : \"value_d_1\"
key_a_2 : \"value_a_2\"
key b_2 : \"value_b_2\"
key_c_2 : \"value_c_2\"
key d_2 : \"value_d_2\"
}
// SNIPPET:
params = {
1
{
key_a : \"value_a_1\"
key b : \"value_b_1\"
key_c : \"value_c_1\"
key d : \"value_d_1\"
}
2
{
\"key_a : value_a_2\"
\"key b : value_b_2\"
\"key_c : value_c_2\"
\"key d : value_d_2\"
}
}
// SNIPPET:
<form method=\"get\">
<span><input type=\"text\" class=\"search rounded\" placeholder=\"Search...\" id='searchbox' autofocus></span>
</form>
// SNIPPET:
$(function(){
$('input[type=\"text\"]').keyup(function(){
var searchText = $(this).val().toLowerCase();
var appendedText= $(this).val();
$('ul > li > a').each(function(){
var currentLiText = $(this).attr('class')
showCurrentLi = currentLiText.indexOf(searchText) !== -1;
$(this).toggle(showCurrentLi);
if (event.which == 13 || event.keyCode == 13) {
chrome.tabs.create({url:'http://www.exampletestsite.com/'+appendText});
return false;
}
return true;
});
});
// SNIPPET:
var appendedText= $('#searchbox').val();
// SNIPPET:
if(isset($_POST['submit'])){
mysql_select_db($database_epl, $epl);
$query_lin = sprintf(\"SELECT * FROM topic WHERE id = %s ORDER BY `Date` DESC\", GetSQLValueString($colname_lin, \"int\"));
$topicId = $_GET['id']; // you need to change 'id' to the name of your ID-parameter in the URL
$viewsIncrementQuery = \"UPDATE `topic` SET `Views` = `Views` + 1 WHERE `id` = \" . $topicId;
$incremented = mysql_query($viewsIncrementQuery, $epl) or die(mysql_error());
// run/execute mysql query
// SNIPPET:
$('.cme-confirm').one( \"click\", function(event) {
if ($(\".this-correct\")[0]){
case1Score = case1Score + 10;
}
event.stopImmediatePropagation();
console.log(case1Score);
});
// SNIPPET:
<table id=\"tableid\">
<thead>
<tr>
<th id=\"Sno\">S No</th>
<th>Name</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody >
@foreach (var sd in Model.Details)
{
<tr id=\"trid\">
<td>@sd .Id</td>
<td>@sd .Name</td>
<td>@sd .Status</td>
<td>
<a id=\"actionId\" onclick=\"Clickfn()\" >
</a>
<script>
function Clickfn() {
window.location.href = '@Url.Action(\"UpdateCamp\", \"CampDashboard\", new {id =@sd .Id })'
}
</script>
</td>
</tr>
}
</tbody>
</table>
// SNIPPET:
div
// SNIPPET:
<script src=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js\"></script>
<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js\"></script>
// SNIPPET:
$(function() {
$('#reset_form').click(function() {
$('#name,#comment,#avatar').val('');
});
$('#submit').click(function() {
var name = $('#name').val();
var comment = $('#comment').val();
var avatar = $('input[type=\"radio\"]:checked').val();
var xSeconds = 5000; // 5 second
setTimeout(function() {
$('.alert').fadeOut('slow');
}, xSeconds);
$.ajax({
url: '../forms/comment_ajax.php?id=<?php echo $_GET['id']; ?>',
data: { form_name: name, form_comment: comment, form_avatar: avatar },
success: function(data) {
$('#new_comment').append(data);
$('#new_comment').effect(\"bounce\", { direction:'down', times:5 }, 300);
return true;
}
});
});
});
// SNIPPET:
div
// SNIPPET:
<div id=\"new_comment\"></div>
// SNIPPET:
submit
// SNIPPET:
div
// SNIPPET:
div
// SNIPPET:
<strong>Name:</strong><br />
<input type=\"text\" id=\"name\" class=\"userpass\" maxlength=\"15\"/><br /><br />
<strong>Comment:</strong> <br />
<textarea id=\"comment\" rows=\"6\" cols=\"75\"></textarea><br /><br />
<input type=\"submit\" id=\"submit\" value=\"Comment\" class=\"button\" />
<input type=\"reset\" id=\"reset_form\" name=\"submit\" value=\"Reset\" class=\"button\" />
// SNIPPET:
$( document ).ready(function() {
$('#selection_0').select(function () {
$('#text_to_speech').show();
$('#recorded_messages').hide();
$('#recorded_messages').find('input, textarea, button, select').each(function () {
$(this).prop('disabled', true)});
$('#text_to_speech').find('input, textarea, button, select').each(function () {
$(this).prop('disabled', false)});
});
$('#selection_1').select(function () {
$('#recorded_messages').show();
$('#text_to_speech').hide();
$('#recorded_messages').find('input, textarea, button, select').each(function () {
$(this).prop('disabled', false)});
$('#text_to_speech').find('input, textarea, button, select').each(function () {
$(this).prop('disabled', true)});
});
});
// SNIPPET:
<?php $id=193; $post = get_page($id); echo $post->post_content; ?>
// SNIPPET:
$(function() {
$(\"#pageOneImage\").backstretch(\"<?php $id=193; $post = get_post_thumbnail_id($id); echo $post->get_post_thumbnail_id; ?>\");
$(\"#pageTwoImage\").backstretch(\"<?php $id=195; $post = get_post_thumbnail_id($id); echo $post->get_post_thumbnail_id; ?>\");
});
// SNIPPET:
<form id=\"send_intake\">
<div class=\"input_line\">Voornaam: <input type=\"text\" name=\"firstname\" id=\"send_intake_firstname\"></div>
<div class=\"input_line\">Achternaam: <input type=\"text\" name=\"lastname\" id=\"send_intake_lastname\"></div>
<div class=\"input_line\">E-mailadres: <input type=\"email\" name=\"email\" id=\"send_intake_email\"></div>
<input type=\"submit\" class=\"form_submit\" value=\"Stuur\">
</form>
<script>
//Send form
$(document).ready(function(){
$(\".function_header\").on( \"click\", \"#submit_send_intake\", function() {
alert (\"click event fired.\");
$(\"#send_intake\").submit(function() {
$.post(\"pages/forms_intake/functions/send_intake_form.php\", $(\"#send_intake\").serialize());
});
});
});
</script>
// SNIPPET:
<div id=\"everything\">
<img id=\"sunset\" src=\"sunset1.jpg\" class=\"img-responsive\" alt=\"Responsive image\">
<img id=\"sun\" src=\"sun1.png\" class=\"img-responsive\" alt=\"Responsive image\">
<img id=\"mountains\" src=\"mountains.png\" class=\"img-responsive\" alt=\"Responsive image\">
<img id=\"space\" src=\"space5compressed.jpg\" alt=\"\">
</div>
// SNIPPET:
body {
display: none;
}
html, body {
width: 100%;
height: 100%;
overflow-y: hidden;
overflow-x: hidden;
background-color: black;
}
#sun {
position: absolute;
bottom: 300px;
left: 0;
right: 0;
margin: 0 auto;
height: 30%;
width: auto;
z-index: -1;
display: none;
}
#sunset {
position: absolute;
bottom: 0px;
z-index: -2;
min-height: 100%;
}
#mountains {
position: relative;
bottom: -100%;
}
#space {
position: absolute;
left: -80%;
bottom: -70%;
min-height: 250%;
min-width: 250%;
max-height: 250%;
max-width: 250%;
z-index: -1;
opacity: 0.0;
/* Spinning space effect*/
-webkit-animation:spin 80s linear infinite;
-moz-animation:spin 80s linear infinite;
animation:spin 80s linear infinite;
}
/* More spinning space effect*/
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
#everything {
position: absolute;
width: 100%;
height: 100%;
z-index: 100;
background-color: black;
}
// SNIPPET:
$(document).ready(function() {
$(\"body\").fadeIn(8000);
$(\"#sun\").fadeIn(8000);
$( \"#mountains\" ).delay( 2000 ).animate({
marginTop: \"-25%\",
}, 6000 );
$(\"#sun\").on(\"click\", function(){
$( \"#sun\" ).animate({
marginBottom: \"-300px\",
}, 8000, \"linear\" );
$( \"#sunset, #sun\" ).delay( 10000 ).animate({
opacity: 0.0,
}, 5000 );
$( \"#space\" ).delay( 14000 ).animate({
opacity: 4.0,
}, 20000 );
});
});
// SNIPPET:
var isPrime = function(n) {
for (i=2;i<n;i++) {
if (n % i === 0) {
return false;
break
} else {
return true
}
}
};
var primeFactors = function(n) {
factorsArray = [];
for (i=0;i<n;i++) {
if (isPrime(i)) {
if (i % n === 0) {
factorsArray.push(i);
}
}
}
return factorsArray
}
// SNIPPET:
var arr = [1,2,3,4];
for(var i=0; i<arr.length;++i){
arr[i].style.backgroundColor = \"rgb(0, 0, 0)\"; // I want to set i element in the array to color red
}
// SNIPPET:
<html>
<head><meta http-equiv=\"refresh\" content=\"60;url=test.html\"/>
<script type=\"text/javascript\">
var hook = true;
window.onbeforeunload = function() {
if (hook) {
return \"msg here\"
}
}
function unhook() {
hook=false;
}
</script>
</head>
<body>
</body>
</html>
// SNIPPET:
var MyModel = Backbone.Model.extend( {} );
// SNIPPET:
var instModel = new MyModel();
instModel instanceof MyModel; // true
instModel instanceof Backbone.Model; // true
// SNIPPET:
MyModel instanceof Backbone.Model; // false
MyModel instanceof Function; // true
// SNIPPET:
var sale=document.getElementById(\"sale\").value; // enter 2
var sale2=document.getElementById(\"sale2\").value; // enter 3
document.getElementById('calsale').value = ((sale2)+(sale)); //now display23.want to display 5
// SNIPPET:
$scope.data.details
// SNIPPET:
<body ng-controller=\"MainCtrl\">
<label set-model=\"data.details[0]\">Label 1</label>
<input type=text/>
{{ data.details[0] }}
<label set-model=\"data.details[1]\">Label 2</label>
<input type=text/>
</body>
// SNIPPET:
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.data = {
details: []
};
});
app.directive('setModel', function() {
return {
restrict: 'EA',
link: function(scope, element, attrs) {
// var pair = JSON.parse(attrs)
scope[attrs.setModel] = element.html();
console.log(scope);
// console.log();
}
};
})
// SNIPPET:
ng-init
// SNIPPET:
<label>
// SNIPPET:
$scope
// SNIPPET:
data: Object
data.details[0]: \"Label 1\"
data.details[1]: \"Label 2\"
// SNIPPET:
details
// SNIPPET:
data
// SNIPPET:
data.details[0]
// SNIPPET:
data
// SNIPPET:
<script type=\"text/javascript\" src=\"/Scripts/jquery-1.7.1.min.js\"></script>
<script type=\"text/javascript\">
function getStateNames(BN) {
$.ajax({
url: \"@Url.Action(\"StateNames\", \"DropDownlist\")\",
data: {CountryName: CN},
dataType: \"json\",
type: \"POST\",
error: function() {
alert(\"An error occurred.\");
},
success: function(data) {
var items = \"\";
$.each(data, function(i, item) {
items += \"<option value=\\\"\" + item.Value + \"\\\">\" + item.Text + \"</option>\";
});
$(\"#State\").html(items);
}
});
}
$(document).ready(function(){
$(\"#Country\").change(function () {
var CN = $(\"#Country\").val();
getStateNames(CN);
});
});
function getCityNames(SN) {
$.ajax({
url: \"@Url.Action(\"CityNames\", \"DropDownlist\")\",
data: { StateName: SN },
dataType: \"json\",
type: \"POST\",
error: function () {
alert(\"An error occurred.\");
},
success: function (data) {
var items = \"\";
$.each(data, function (i, item) {
items += \"<option value=\\\"\" + item.Value + \"\\\">\" + item.Text + \"</option>\";
});
$(\"#CityName\").html(items);
}
});
}
$(document).ready(function () {
$(\"#StateName\").change(function () {
var SN = $(\"#StateName\").val();
getCityNames(SN);
});
});
// SNIPPET:
$(\"textarea\").bind('copy', function() {
this.remove();
});
// SNIPPET:
<a href=\"javascript:\" id=\"helkaSubmit\" class=\"ProductsSearch blueButton\" title=\"בצע חיפוש גוש וחלקה לפי כתובת\">חפש</a>
// SNIPPET:
WebDriver driver = new HtmlUnitDriver();
driver.get(\"http://mapi.gov.il/Pages/LotAddressLocator.aspx\");
((HtmlUnitDriver) driver).setJavascriptEnabled(true);
WebElement element = driver.findElement(By.id(\"AddressInput\"));
element.sendKeys(\"הנגיד 16\");
WebElement button = driver.findElement(By.id(\"helkaSubmit\"));
button.click();
String pageSource=driver.getPageSource();
System.out.println(pageSource);
// SNIPPET:
executor.executeScript(\"document.getElementById('helkaSubmit').href='http://www.google.co.il';\");
executor.executeScript(\"document.getElementById('helkaSubmit').click();\");
// SNIPPET:
var fileref=document.createElement('script')
fileref.setAttribute(\"type\",\"text/javascript\")
fileref.setAttribute(\"src\", \"../scripts/sample.js\");
$(\"head\").append(fileref);
// SNIPPET:
<button type=\"button\" data-icon=\"gear\" data-iconpos=\"right\" data-mini=\"true\" data-inline=\"true\" id=\"add\">Add</button>
<button type=\"button\" data-icon=\"plus\" data-iconpos=\"right\" data-mini=\"true\" data-inline=\"true\" id=\"expand\">Expand last</button>
<button type=\"button\" data-icon=\"minus\" data-iconpos=\"right\" data-mini=\"true\" data-inline=\"true\" id=\"collapse\">Collapse last</button>
<div data-role=\"collapsibleset\" data-content-theme=\"a\" data-iconpos=\"right\" id=\"set\">
<div data-role=\"collapsible\" id=\"set1\" data-collapsed=\"true\">
<h3>Section 1</h3>
<p>I'm the collapsible content.</p>
</div>
</div>
// SNIPPET:
$( document ).on( \"pagecreate\", function() {
var nextId = 1;
$(\"#add\").click(function() {
nextId++;
var content = \"<div data-role='collapsible' id='set\" + nextId + \"'><h3>Section \" + nextId + \"</h3><p>I am the collapsible content in a set so this feels like an accordion. I am hidden by default because I have the 'collapsed' state; you need to expand the header to see me.</p></div>\";
$( \"#set\" ).append( content ).collapsibleset( \"refresh\" );
});
$( \"#expand\" ).click(function() {
$(\"#set\").children(\":last\").collapsible( \"expand\" );
});
$( \"#collapse\" ).click(function() {
$( \"#set\" ).children( \":last\" ).collapsible( \"collapse\" );
});
});
// SNIPPET:
var PerformerSchema = new Schema({
_id: Number,
firstname: String,
lastname: String,
active: Boolean
});
// SNIPPET:
Performer.find({
'active': true
}, function(err, performers) {
if (err) {
return handleError(res, err);
}
if (!performers) {
return res.send(404);
}
return res.json(performers);
});
// SNIPPET:
$(function () {
var rowItem = $(\".row\", $(\".formitems\")); //select all rows from class formitems
$(\".formitems\").on(\"click\", \".addRow\", function () {
var newItem = rowItem.clone(),
rowIndex = $(\".row\", $(\".formitems\")).length;
$(\":input\", newItem).each(function (c, obj) {
$(obj).attr(\"name\", $(obj).attr(\"crap\") + rowIndex);
});
$(\".formitems\").append(newItem); // adds At the end of the container
}).on(\"click\", \".removeRow\", function () {
if ($(\".row\", $(\".formitems\")).length > 1) {
var target = $(this).parent().parent().parent().parent(\".row\");
target.slideUp(function () {
target.remove();
});
}
for (i = 0; i < $(\".row\", $(\".formitems\")).length; i++) //select our div called //formitems and then count rows in it
{
rowobj = $(\".row\", $(\".formitems\"))[i];
$(\":input\", rowobj).each(function (c, obj) {
$(obj).attr(\"name\", $(obj).attr(\"crap\") + i);
})
}
});
});
// SNIPPET:
var str = \"www.myweb.com/in/products/index.aspx\";
var pattern2 = new RegExp('www.myweb.com','i');
var str1 = str.replace(pattern2, 'https://www-stg.myweb.com:60002');
window.location.href = str1;
// SNIPPET:
https://
// SNIPPET:
www-stg.myweb.com
// SNIPPET:
alert
// SNIPPET:
console.log()
// SNIPPET:
http
// SNIPPET:
.paging-navigation a
// SNIPPET:
$('#article-list').on('click', '.paging-navigation a', function(e){
e.preventDefault();
var link = $(this).attr('href');
$('html, body').animate({
scrollTop: $('#news').offset().top - 60
}, 500);
$('#article-list').fadeOut(500, function(){
// I would like to put in the animation gif here
and fade it away when the new set of posts
fade in.
$(this).load(link + ' #article-list', function() {
$(this).find('#article-list > *').unwrap().end().fadeIn(500);
});
});
});
// SNIPPET:
<div id=\"news\">
<div id=\"article-list\">
<img class=\"loading-list\" src=\"loading.gif\" style=\"display:none\">
(blog posts here)
<div class=\"paging-navigation\">
<div class=\"nav-previous\">
<a href=\"#\">Prev</a>
</div>
<div class=\"nav-next\">
<a href=\"#\">Next</a>
</div>
</div>
</div>
</div>
// SNIPPET:
.loading-list
// SNIPPET:
$('#article-list').on('click', '.paging-navigation a', function(e){
e.preventDefault();
var link = $(this).attr('href');
$('html, body').animate({
scrollTop: $('#news').offset().top - 60
}, 500);
$('#article-list').fadeOut(500, function(){
$('.loading-list').show(); <// added
$(this).load(link + ' #article-list', function() {
$(this).find('#article-list > *').unwrap().end().fadeIn(500);
});
$('.loading-list').hide(); <// added
});
});
// SNIPPET:
#article-list
// SNIPPET:
#news #article-list {
overflow: hidden;
text-align: center;
}
// SNIPPET:
angular.module('FlickrMaps', ['SignalR'])
.factory('PhotoMarkers', ['$rootScope', 'Hub', function ($rootScope, Hub) {
var PhotoMarkers = this;
//Hub setup
var hub = new Hub('photos', {
listeners: {
'addTotalPhotosCount': function (total) {
PhotoMarkers.totalCount = total;
$rootScope.$apply();
},
'initPhotoMarker': function (photo) {
var photolocation = new window.google.maps.LatLng(photo.Latitude, photo.Longitude);
var marker = new window.google.maps.Marker({
position: photolocation,
title: photo.Title,
photoThumb: photo.PhotoThumbScr,
photoOriginal: photo.PhotoOriginalScr
});
window.google.maps.event.addListener(marker, 'click', function () {
$rootScope.$broadcast('markerClicked', marker);
});
PhotoMarkers.all.push(marker);
$rootScope.$apply();
},
'photosProcessed': function () {
PhotoMarkers.processedPhotosCount++;
if (PhotoMarkers.processedPhotosCount == PhotoMarkers.totalCount && PhotoMarkers.processedPhotosCount > 0) {
$rootScope.$broadcast('markersLoaded');
}
$rootScope.$apply();
},
},
methods: ['loadRecentPhotos'],
errorHandler: function (error) {
console.error(error);
}
});
//Variables
PhotoMarkers.all = [];
PhotoMarkers.processedPhotosCount = 0;
PhotoMarkers.totalCount = 0;
//Methods
PhotoMarkers.load = function () {
hub.promise.done(function () { //very important!
hub.loadRecentPhotos();
});
};
return PhotoMarkers;
}])
.controller('MapController', ['$scope', 'PhotoMarkers', function ($scope, PhotoMarkers) {
$scope.markers = PhotoMarkers;
$scope.image = '123';
$('#myModal').modal({
backdrop: 'static',
keyboard: false
});
$scope.$on('markerClicked', function (event, data) {
console.log(data.photoThumb);
$scope.omfg = 'nkfglfghlfghflj';
});
$scope.$on('markersLoaded', function () {
$('#myModal').modal('toggle');
$scope.image = 'lol';
var mapOptions = {
zoom: 4,
center: new window.google.maps.LatLng(40.0000, -98.0000),
mapTypeId: window.google.maps.MapTypeId.TERRAIN
};
console.log(PhotoMarkers.all);
$scope.map = new window.google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var markerCluster = new MarkerClusterer($scope.map, $scope.markers.all);
});
}])
// SNIPPET:
if (bValidate == false)
{
ScriptManager.RegisterClientScriptBlock(this,typeof(Page), \"pro\", \"alert('SMTP Server is Down. Please try again');\",true);
}
// SNIPPET:
\"1\"==1 //true
// SNIPPET:
\"1\"+1 // '11\"
// SNIPPET:
[{\"name\":\"someName\", \"values\":[{x1, y1}, {x2, y2}, ... {xn, yn}, ...]
// SNIPPET:
var line = d3.svg.line()
.x(function(d) { return x(d.x); })
.y(function(d) { return y(d.y); });
// data is a list of objects, each of which respresents a line
var series = svg.selectAll(\".series\")
.data(dataSimplified)
.enter().append(\"g\")
.attr(\"class\", \"series\");
series.append(\"path\")
.attr(\"class\", \"line\")
// the following function requires a list of things, like [{x0, y0}, {x1, y1}, ... {xn, yn}]
.attr(\"d\", function(d) { return line(d.values); })
.style(\"stroke\", function(d) { return color(d.name); });
// SNIPPET:
// add points
for(var i=0; i<dataSimplified.length; i++){
for(var j=0; j<dataSimplified[i].values.length; j++){
svg.append(\"circle\")
.attr(\"r\", 3.5)
.attr(\"cx\", function(d){ return x(dataSimplified[i].values[j].x); })
.attr(\"cy\", function(d){ return y(dataSimplified[i].values[j].y); })
.attr(\"fill\", function(d){ return color(dataSimplified[i].name); });
}
}
// SNIPPET:
absolute
// SNIPPET:
.wrapper {
min-width: 900px;
}
.header {
height: 0px;
width: 604px;
margin-right: auto;
margin-left: auto;
position: relative;
-webkit-transition: transform 0.5s ease 0s;
-moz-transition: transform 0.5s ease 0s;
-ms-transition: transform 0.5s ease 0s;
-o-transition: transform 0.5s ease 0s;
transition: transform 0.5s ease 0s;
}
/* Page 1 */
.wrapper .contentpagewrapper1 {
height: auto;
width: 650px;
margin-right: auto;
margin-left: auto;
position: relative;
z-index: 6;
opacity: 1;
display: block;
top: -10px;
}
.wrapper .contentpage1 {
background-image: url(../images/Page%20no%20shadow2.jpg);
background-repeat: repeat;
background-position: center center;
box-shadow: 0px 0px 50px 1px #000000;
height: auto;
width: 650px;
margin-right: auto;
margin-left: auto;
position: absolute;
top: 70px;
}
.wrapper .contentpage1 h1 {
font-family: 'Lusitana', serif;
color: #666;
padding-left: 15px;
padding-top: 10px;
}
.wrapper .contentpage1 p {
font-family: 'Lusitana', serif;
color: #999;
padding-right: 15px;
padding-bottom: 15px;
padding-left: 15px;
}
/* Page 2 */
.wrapper .contentpagewrapper2 {
height: auto;
width: 650px;
margin-right: auto;
margin-left: auto;
position: relative;
z-index: 6;
opacity: 1;
display: none;
top: -10px;
}
.wrapper .contentpage2 {
background-image: url(../images/Page%20no%20shadow2.jpg);
background-repeat: repeat;
background-position: center center;
box-shadow: 0px 0px 50px 1px #000000;
height: auto;
width: 650px;
margin-right: auto;
margin-left: auto;
position: absolute;
top: 70px;
}
.wrapper .contentpage2 h1 {
font-family: 'Lusitana', serif;
color: #666;
padding-left: 15px;
padding-top: 10px;
}
.wrapper .contentpage2 p {
font-family: 'Lusitana', serif;
color: #999;
padding-right: 15px;
padding-bottom: 15px;
padding-left: 15px;
}
/* Page 3 */
.wrapper .contentpagewrapper3 {
height: auto;
width: 650px;
margin-right: auto;
margin-left: auto;
position: relative;
z-index: 6;
opacity: 1;
display: none;
top: -10px;
}
.wrapper .contentpage3 {
background-image: url(../images/Page%20no%20shadow2.jpg);
background-repeat: repeat;
background-position: center center;
box-shadow: 0px 0px 50px 1px #000000;
height: auto;
width: 650px;
margin-right: auto;
margin-left: auto;
position: absolute;
top: 70px;
}
.wrapper .contentpage3 h1 {
font-family: 'Lusitana', serif;
color: #666;
padding-left: 15px;
padding-top: 10px;
}
.wrapper .contentpage3 p {
font-family: 'Lusitana', serif;
color: #999;
padding-right: 15px;
padding-bottom: 15px;
padding-left: 15px;
}
.header:hover {
transform: scale(1.05);
cursor: pointer;
}
.navbar {
height: 0px;
width: 400px;
margin-right: auto;
margin-left: auto;
z-index: 5;
position: relative;
top: 200px;
}
.navbar ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.navbar a {
display: block;
width: 400px;
height: 79px;
text-align: center;
padding-top: 20px;
background-image: url(../images/Menu%20Button2.png);
text-decoration: none;
color: #FFF;
text-shadow: 1px 1px 5px #000000;
background-position: center center;
font-size: 24px;
font-family: Arial, Helvetica, sans-serif;
line-height: 60px;
position: relative;
-webkit-transition: color 0.5s ease 0s;
-moz-transition: color 0.5s ease 0s;
-ms-transition: color 0.5s ease 0s;
-o-transition: color 0.5s ease 0s;
transition: color 0.5s ease 0s;
}
.navbar a:hover {
color: #D4B906;
}
.header #logo {
height: 200px;
width: 504px;
margin-right: auto;
margin-left: auto;
z-index: 4;
}
.navbar .show, a:hover span {
display: none;
}
.navbar a:hover .show {
display: inline;
}
.wrapper .header2 {
position: fixed;
height: 73px;
width: 100%;
text-align: center;
z-index: 8;
}
.navbar2 {
position: relative;
height: 73px;
width: 880px;
margin-right: auto;
margin-left: auto;
background-image: url(../images/Header3.png);
background-repeat: no-repeat;
background-position: center center;
background-color: #FF0;
}
.navbar2 .navshadow {
box-shadow: 0 5px 40px -15px black;
height: 65px;
width: 745px;
margin-right: auto;
margin-left: auto;
position: relative;
left: -2px;
}
.navbar2 .menu2 {
list-style-type: none;
padding: 0;
margin-right: auto;
margin-left: auto;
text-align: center;
margin-top: 0;
margin-bottom: 0;
line-height: 100px;
}
.navbar2 li {
display: inline;
}
.navbar2 li:nth-child(1) {
padding-right: 5px;
padding-left: 10px;
}
.navbar2 li:nth-child(2) {
padding-right: 10px;
padding-left: 10px;
}
.navbar2 li:nth-child(3) {
padding-right: 145px;
padding-left: 145px;
}
.navbar2 li:nth-child(4) {
padding-right: 5px;
padding-left: 5px;
}
.navbar2 li:nth-child(5) {
padding-right: 5px;
padding-left: 5px;
}
.navbar2 a {
text-align: center;
text-decoration: none;
font-family: Arial, Helvetica, sans-serif;
color: #7A6E00;
font-size: 18px;
-webkit-transition: color 0.5s ease 0s;
-moz-transition: color 0.5s ease 0s;
-ms-transition: color 0.5s ease 0s;
-o-transition: color 0.5s ease 0s;
transition: color 0.5s ease 0s;
}
.navbar2 a:hover {
color: #FFF;
}
// SNIPPET:
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>Lemon Tree</title>
<META NAME=\"ROBOTS\" CONTENT=\"NOINDEX, NOFOLLOW\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"css/about.css\"/>
<link href='http://fonts.googleapis.com/css?family=Lusitana:700,400' rel='stylesheet' type='text/css'>
<link rel=\"stylesheet\" type=\"text/css\" href=\"js/font-awesome-4.2.0/css/font-awesome.min.css\"/>
<script src=\"js/jquery-1.11.1.min.js\"></script>
<script src=\"js/jquery.nicescroll.js\"></script>
<script src=\"js/fullPage.js-master/fullPage.js-master/vendors/jquery.easings.min.js\"></script>
<script type=\"text/javascript\" src=\"js/GSAP/src/minified/TweenMax.min.js\"></script>
<script type=\"text/javascript\">
$(document).ready(function() {
$(\"html\").niceScroll({
cursorcolor: \"#FF0\"
});
});
</script>
<style type=\"text/css\">
html {
background: url(images/BG.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-color: #FFF;
}
body {
margin: 0px;
}
</style>
</head>
<body>
<div class=\"wrapper\">
<div class=\"header2\">
<div class=\"navbar2\">
<div class=\"navshadow\">
<ul class=\"menu2\">
<li><a id=\"homepage2\" href=\"index.html\"><i class=\"fa fa-home\"></i> Home</a></li>
<li><a id=\"aboutpage2\" href=\"about.html\"><i class=\"fa fa-info-circle\"></i> About Us</a></li>
<li><a id=\"homepage2\" href=\"index.html\">       </a></li>
<li><a id=\"servicespage2\" href=\"services.html\"><i class=\"fa fa-tasks\"></i> Services</a></li>
<li><a id=\"contactpage2\" href=\"contact.html\"><i class=\"fa fa-envelope\"></i> Contact</a></li>
</ul>
</div>
</div>
</div>
<div class=\"contentpagewrapper1\">
<div class=\"contentpage1\">
<h1><i class=\"fa fa-info-circle\"></i> Who Are We?</h1><p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.</p>
<p>Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere.</p>
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere.</p>
</div>
</div>
</div> <!-- wrap -->
</body>
</html>
// SNIPPET:
Backbone.history.navigate(\"page\", {trigger: true});
// SNIPPET:
routes: {
\"page\": \"page\",
},
initialize: function () {
this.currentView = undefined;
var page;
page = new Login();
this.changePage(page);
},
page: function () {
var myview = new View({});
this.changePage(myview );
},
changePage: function (page) {
if(this.currentView) {
this.currentView.remove();
this.currentView.off();
}
this.currentView = page;
page.render();
}
// SNIPPET:
find -type f|xargs grep \"name_of_the_class\"
// SNIPPET:
orientation change event
// SNIPPET:
<div id='aDiv'>
<div id='anANotherDiv'>An Another Div</div>
</div>
// SNIPPET:
$('anANotherDiv').click(function(){
var b='An Another Div'
console.log(b);
});
$('#aDiv').html('<div id='oDiv'>This div override the another</div>');
$('#oDiv').click(function(){
var a='This div override the another';
console.log(a);
});
// SNIPPET:
Error: w is not a function
// SNIPPET:
var app = angular.module('app', [
'homepageControllers',
'ngRoute'
]);
app.config(['$routeProvider',
function ($routeProvider) {
$routeProvider.
when('/', {
templateUrl: 'views/home-page.html',
controller: 'homePageCtrl'
}).
otherwise({
redirectTo: '/homepage'
});
}]);
// SNIPPET:
var homepageControllers = angular.module('homepageControllers', []);
homepageControllers.controller('homePageCtrl', function ($scope, $http) {
console.log(\"controller loaded\");
});
// SNIPPET:
<div>
Work ffs!
</div>
// SNIPPET:
<div ng-view></div>
// SNIPPET:
<select name=\"mySelect\" id=\"mySelect\" onchange=\"getSelectedValue();\">
<option value=\"1\">Text 1</option>
<option value=\"2\">Text 2</option>
// SNIPPET:
function getSelectedValue() {
var index = document.getElementById('mySelect').selectedIndex;
var index = document.getElementById('mySelect').value;
return index;
}
function passValue(x){
var a = x;
alert(a);
}
passValue(getSelectedValue());
// SNIPPET:
var listeners = [];
app.get('/stream', function (req, res) {
listeners.push({ req: req, res: res });
});
// ... something happens
notify(listeners);
// SNIPPET:
req.on('close', fn);
// SNIPPET:
<!DOCTYPE html>
<head>
<title>Learning AngularJS</title>
<script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>
<script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js\" type=\"text/javascript\"></script>
</head>
<body>
<div class=\"container\" style=\"background: #eec; min-height:300px; margin-top: 15px;\" ng-controller=\"SimpleController\">
<ul>
<li ng-repeat=\"woman in customer\">{{ woman.name }}</li>
</ul>
</div>
// SNIPPET:
<script>
function SimpleController($scope) {
$scope.customer = [
{ name: 'Kamila', city: 'Opava' },
{ name: 'Nikola', city: 'Opočno' },
{ name: 'Jana', city: 'Pardubice' },
{ name: 'Martina', city: 'Hradec Kralove' },
{ name: 'Justýna', city: 'Chrudim' }
];
};
</script>
</body>
</html>
// SNIPPET:
{{ woman.name }}
// SNIPPET:
//resize
function resize_scroll_pane() {
var dynamic_height = $(window).height() - ($(\".navbar\").outerHeight() + $(\".footer\").outerHeight());
$(\".scroll-pane, .items, .items img\").css(\"height\",dynamic_height + \"px\");
}
$(document).ready(function() {
resize_scroll_pane();
$(window).bind('resize', resize_scroll_pane);
});
// SNIPPET:
<select multiple=\"multiple\">
<option>_c</option>
<option>b</option>
<option>_v</option>
<option>a</option>
</select>
// SNIPPET:
$(document).ready(function() {
var a = [];
$('option').each(function() {
a.push($(this).text());
});
$('option').each(function() {
var v = $(this).text();
var s = v.substring(0,1);
if (s == '_') {
a.unshift($(this).text());
}
});
a.sort();
for (i = 0; i < a.length; i++) {
$('option').eq(i).text(a[i]);
}
});
// SNIPPET:
_c
_c
_v
_v
// SNIPPET:
http://demo#####.mockable.io/items
// SNIPPET:
http://demo#####.mockable.io/items?pid=5
// SNIPPET:
<html>
<head>
<script src=\"http://code.jquery.com/jquery-1.10.1.min.js\">
</script>
<script>
$(document).ready(function(){
$(\"#btnjson\").click(function(){
$.getJSON(\"http://waitrapp.co/bipin/practice.php\",function(result){
$(\"#ID\").append(result.ID);
$(\"#Item_Name\").append(result.Item_Name);
$(\"#Item_Price\").append(result.Item_Price);
});
});
});
</script>
</head>
<body>
<button id=\"btnjson\">Load!!!</button>
<p id=\"ID\">ID: </p>
<p id=\"Item_Name\">Item Name: </p>
<p id=\"Item_Price\">Item Price: </p>
</body>
</html>
// SNIPPET:
<div>
<div class=\"dropzone\"></div>
<input type=\"file\" multiple onchange=\"angular.element(this).scope().setFiles(this)\">
<a class=\"upload\">Add new image</a>
</div>
// SNIPPET:
$timeout(function() {
elem.find('input').triggerHandler('click');
}, 0);
// SNIPPET:
elem[1].click();
// SNIPPET:
elem[1].triggerHandler('click');
// SNIPPET:
undefined is not an object (evaluating 'elem[1].triggerHandler')
// SNIPPET:
factory('myFactory', function(anotherFactory) {
var factoryObject = {};
factoryObject.myMethod = () {
var newObjectToReturn;
// async call
anotherFactory.get(id, function(data) {
// do some processing
newObjectToReturn = data;
});
return newObjectToReturn;
}
return factoryObject;
});
// SNIPPET:
<div id=\"text\"></div>
// SNIPPET:
document.getElementById(\"text\").innerHTML = \"Hello <br /> World\";
var x = document.getElementById(\"text\").innerHTML;
if(x == \"Hello <br /> World\")
{
alert('Match');
}
// SNIPPET:
$('#myRepeater').repeater({
dataSource: dataSource
});
// SNIPPET:
<label for=\"options_2074\">None</label>
// SNIPPET:
None
// SNIPPET:
Black
// SNIPPET:
<span id=\"backingBlackTooltip\"><img src=\"https://www.neonandmore.com/tooltips/question_mark.png\"></span>
// SNIPPET:
</label>
// SNIPPET:
#product-options-wrapper .input-box:first .options-list + .label label
// SNIPPET:
<div class=\"product-options\" id=\"product-options-wrapper\">
<dl class=\"last\">
<dt><label>Backing</label></dt>
<dd>
<div class=\"input-box\">
<ul id=\"options-2074-list\" class=\"options-list\">
<li>
<input type=\"radio\" id=\"options_2074\" class=\"radio product-custom-option\" name=\"options[2074]\">
<span class=\"label\">
<label for=\"options_2074\">None</label>
</span>
</li>
</ul>
</div>
</dd>
</dl>
</div>
// SNIPPET:
$.ajax({
type: \"POST\",
url: \"Newdashboard.aspx/finalvalue\",
contentType: \"application/json; charset=utf-8\",
data: JSON.stringify(),
datatype: 'json',
async: false,
success: function (data) {
if (data.d == '[]') {
alert('No Matches found');
}
else {
// here bind div
}
},
error: function (e) {
alert(\"check once...\");
}
});
// SNIPPET:
finalvalue
// SNIPPET:
console.log(N)
// SNIPPET:
console.log(1)
console.log(2)
console.log(3)
// SNIPPET:
$(document).ready(function() {
//
// SNIPPET:
PLUGIN kalininModals INITIALIZATION
// SNIPPET:
$('.menu_button').kalininModals();
);
(function($){
//
// SNIPPET:
options
// SNIPPET:
$.fn.kalininModals = function(options) {
var options = $.extend({},options);
return this.each(function(e) {
//
// SNIPPET:
properties
// SNIPPET:
var self = $(this),
selfModals = $('#modalOuter'),
selfModalsWindow = $('#modalWindow'),
head,
info,
actionsArr;
//
// SNIPPET:
methods
// SNIPPET:
function initForm(formNum){
//console.log('___' + self.text());
if(formNum == 1){
console.log(1);
head = 'Обратный звонок';
}
else if(formNum == 2){
console.log(2);
head = 'Обратный звонок';
}
else if(formNum == 3){
console.log(3);
head = 'Обратный звонок';
};
}
function makeBody(){
console.log('make');
$('#head .h2').text(head);
$('#info').html(info);
}
//
// SNIPPET:
handlers
// SNIPPET:
function onClickControls(e){
self = $(e.currentTarget);
initForm(self.attr('data-form-num'));
makeBody();
}
//
// SNIPPET:
events
// SNIPPET:
$('#menuButton1, #menuButton2, #menuButton3').on('click', onClickControls);
});
};
})($);
// SNIPPET:
<input type=\"button\" onclick=\"javascript:Test()\" value=\"Click Me\" />
// SNIPPET:
(function () {
function Test() {
alert('Yay');
}
})();
// SNIPPET:
<script type=\"text/javascript\">
function checkAdvSearch(checked) {
if(checked) {
document.getElementById(\"searchTerm2\").style.display = '';
document.getElementById(\"searchField2\").style.display = '';
}else {
document.getElementById(\"searchTerm2\").style.display = 'none';
document.getElementById(\"searchField2\").style.display = 'none';
document.getElementById(\"searchLOB\").style.display = 'none';
document.getElementById(\"searchTerm2\").value = '';
document.getElementById(\"searchField2\").value = 'clientName';
document.getElementById(\"searchStatus\").value = '';
document.getElementById(\"searchLOB\").value = '';
}
}
</script>
...
<!-- for advanced search -->
<td Valign=top width=300>
<input type=\"checkbox\" name=\"advSearch\" onclick=\"checkAdvSearch(this.checked);\" tabindex=\"5\"/>Advanced Search
<html:text property=\"searchTerm2\" value=\"\" style=\"display:none\" tabindex=\"6\"/>
</td>
<td Valign=top width=178>
<html:select property=\"searchField2\" onchange=\"showOptions2(this.form)\" value= \"\" style=\"display:none\" tabindex=\"7\">
<html:option value=\"clientName\">Insured Name</html:option>
<html:option value=\"policy\">Policy Number</html:option>
...
</html:select>
</td>
...
// SNIPPET:
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
var url = this.series.options.url;
if (!this.series.options.clickable) {
return;
}
if (this.series.options.url == \"\") {
$scope.vm.ParentController.generateDrilldown(this.series.options.name, this.x - 1);
} else {
window.open(this.series.options.url);
}
}
}
},
}
}
// SNIPPET:
heat = L.heatLayer([], { maxZoom: 12 }).addTo(map);
$.getJSON(\"js/example-single.geojson\", function(data) {
var geojsosn = L.geoJson(data, {
onEachFeature: function (feature, layer) {
console.log(feature.geometry.coordinates[0] ,feature.geometry.coordinates[1]);
heat.addLatLng(feature.geometry.coordinates[0], feature.geometry.coordinates[1]);
}
});
// SNIPPET:
{ \"type\": \"FeatureCollection\",
\"features\": [
{ \"type\": \"Feature\",
\"geometry\": {\"type\": \"Point\", \"coordinates\": [13.353323936462402, 38.11200434622822]},
\"properties\": {\"marker-color\": \"#000\"}
}
]
}
// SNIPPET:
echo <<<EOT
<script type=\"text/javascript\">
$( document ).ready( function () {
var w = window.open(\"{$address} result\", \"#\", \"width=800,height=600\");
var d = w.document.open();
d.write(\"<!DOCTYPE html>
<html>
<head>
<title>{$address} result</title>
<link rel=\"stylesheet\" href=\"css/base.css\" type=\"text/css\" />
</head>
<body>
<code>
Request method: {$request_method}
{$address}?{$qry_cfg}&amp;{$man_qry}
$result
</code>
</body>
</html>\");
d.close();
});
</script>
EOT;
// SNIPPET:
Uncaught SyntaxError: Unexpected token ILLEGAL
// SNIPPET:
line 15
// SNIPPET:
d.write
// SNIPPET:
<script type=\"text/javascript\">
$( document ).ready( function () {
var w = window.open(\"https://api.classmarker.com/v1/groups/recent_results.json result\", \"#\", \"width=800,height=600\");
var d = w.document.open();
d.write(\"<!DOCTYPE html>
<html>
<head>
<title>https://api.classmarker.com/v1/groups/recent_results.json result</title>
<link rel=\"stylesheet\" href=\"css/base.css\" type=\"text/css\" />
</head>
<body>
<code>
Request method: 0
https://api.classmarker.com/v1/groups/recent_results.json?api_key=d4tsE7SvEgzAKlJPFrlvAz3oe9uFQnxy&amp;signature=4495a14efc483aa5ee2f6d4cd480f968&amp;timestamp=1335783600&amp;finishedAfterTimestamp=1335783600&amp;=
{\"status\":\"error\",\"request_path\":\"v1\\/groups\\/recent_results\",\"server_timestamp\":1415026084,\"finished_after_timestamp_used\":1413809284,\"error\":{\"error_code\":\"timeStampOutOfRange\",\"error_message\":\"Access denied. Timestamp issue. Recalculate the digital signature with each call. (There is a 5-minute window of time variance allowed.) Use seconds since the UNIX Epoch, not milliseconds. Make sure your server calling our service is in sync with an atomic clock.\"}}
</code>
</body>
</html>\");
d.close();
});
</script>
// SNIPPET:
<select>
// SNIPPET:
function function1()
{
var country=document.getElementById('id1').value;
switch(country)
{
case \"India\":
logo=\"rupee.png\";
break;
case \"US\":
logo=\"dollar-logo.png\";
break;
case \"Britan\":
logo=\"yen.png\";
break;
}
// SNIPPET:
<td><img src=\"+logo+\" width=30 height=30></td>
// SNIPPET:
<td><img src=\"<%Eval(logo)%>\" width=30 height=30></td>
// SNIPPET:
medium
// SNIPPET:
Mozilla Inspector
// SNIPPET:
GET http://parasclasses.com/ [HTTP/1.1 200 OK 1957ms]
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3619
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3621
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3628
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3683
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3685
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3692
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3719
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3724
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3726
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3747
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3752
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3754
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3782
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3784
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3789
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3810
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3812
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3817
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3860
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3865
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3867
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3872
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3874
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3879
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3881
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3916
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3921
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3923
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3928
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3930
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3935
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3937
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3975
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3977
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:3982
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:4003
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:4005
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:4010
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:4301
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:4335
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:4337
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:4424
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:4803
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:4987
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:4995
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:4997
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:5004
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:5006
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:5016
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:5032
Unknown property '-moz-background-clip'. Declaration dropped. theme-style.css:5043
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:5107
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:5117
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:5119
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:5230
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:5303
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:5543
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:5596
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:5826
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:5862
Error in parsing value for 'box-shadow'. Declaration dropped. theme-style.css:5865
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:5866
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:5869
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:5907
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:5910
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:6006
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:6009
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:6015
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:6018
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:6027
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:6030
Expected media feature name but found '-webkit-min-device-pixel-ratio'. theme-style.css:6106
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:6138
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:6168
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:6245
Unknown property 'speak'. Declaration dropped. theme-style.css:6279
Unknown property 'speak'. Declaration dropped. theme-style.css:6287
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:6322
Unknown property 'speak'. Declaration dropped. theme-style.css:6356
Unknown property 'speak'. Declaration dropped. theme-style.css:6364
Unknown property 'speak'. Declaration dropped. theme-style.css:6398
Unknown property 'speak'. Declaration dropped. theme-style.css:6447
Unknown property 'speak'. Declaration dropped. theme-style.css:6475
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:6511
Unknown property 'speak'. Declaration dropped. theme-style.css:6576
Unknown property 'speak'. Declaration dropped. theme-style.css:6589
Unknown property 'speak'. Declaration dropped. theme-style.css:6658
Unknown property 'speak'. Declaration dropped. theme-style.css:6752
Unknown property 'speak'. Declaration dropped. theme-style.css:6845
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:6967
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:7031
Unknown pseudo-class or pseudo-element '-ms-input-placeholder'. Ruleset ignored due to bad selector. theme-style.css:7042
Unknown pseudo-class or pseudo-element '-webkit-input-placeholder'. Ruleset ignored due to bad selector. theme-style.css:7045
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:7105
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:7111
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:7152
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:7295
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:7300
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:7347
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:7350
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:7429
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:7751
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:7760
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:7764
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:7766
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:7865
Unknown property 'speak'. Declaration dropped. theme-style.css:8260
Unknown property 'speak'. Declaration dropped. theme-style.css:8273
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:8297
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:8330
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:8337
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:8344
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:8351
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:8374
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8387
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8394
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8396
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8439
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8441
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8446
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8448
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8462
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8464
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:8483
Unknown property '-moz-border-radius-bottomright'. Declaration dropped. theme-style.css:8546
Unknown property '-moz-border-radius-bottomleft'. Declaration dropped. theme-style.css:8547
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:8555
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:8594
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:8624
Error in parsing value for 'min-width'. Declaration dropped. theme-style.css:8706
Error in parsing value for 'overflow-x'. Declaration dropped. theme-style.css:8735
Unknown property 'zoom'. Declaration dropped. theme-style.css:8756
Expected declaration but found '*'. Skipped to next declaration. theme-style.css:8757
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8766
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8768
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8795
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8797
Unknown property 'zoom'. Declaration dropped. theme-style.css:8804
Expected declaration but found '*'. Skipped to next declaration. theme-style.css:8805
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8814
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8816
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8822
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8824
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:8869
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8872
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:8875
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:8879
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8882
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:8898
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:8959
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:8962
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9133
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:9137
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:9140
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:9206
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9211
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:9282
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:9284
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9319
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9334
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9348
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9367
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9402
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9620
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9698
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9734
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:9738
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:9741
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9754
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9859
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:9863
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:9866
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9879
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:9885
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9900
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9958
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9963
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:9988
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:10280
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:10539
Unknown property '-moz-border-radius'. Declaration dropped. theme-style.css:10574
Error in parsing value for 'box-shadow'. Declaration dropped. theme-style.css:10577
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:10578
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:10581
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:10619
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:10622
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:10716
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:10719
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:10725
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:10728
Error in parsing value for 'background-image'. Declaration dropped. theme-style.css:10737
Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. theme-style.css:10740
Unknown property '-moz-border-radius'. Declaration dropped. colour-blue.css:79
Unknown property '-moz-border-radius'. Declaration dropped. colour-blue.css:386
Error in parsing value for 'background-image'. Declaration dropped. colour-blue.css:918
GET http://platform.twitter.com/widgets.js [HTTP/1.1 304 Not Modified 656ms]
Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead jquery.min.js:1
GET http://parasclasses.com/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js [HTTP/1.1 200 OK 1603ms]
GET http://parasclasses.com/plugins/jPanelMenu/jquery.jpanelmenu.min.js [HTTP/1.1 200 OK 705ms]
GET http://parasclasses.com/plugins/jRespond/js/jRespond.js [HTTP/1.1 200 OK 3097ms]
GET http://parasclasses.com/plugins/clingify/jquery.clingify.min.js [HTTP/1.1 200 OK 3827ms]
Use of getPreventDefault() is deprecated. Use defaultPrevented instead. jquery.min.js:5
Unknown property '-moz-outline'. Declaration dropped. timeline.3fb0c4c981cd3f8f8dfb6b0ab93d6a9e.default.css:1
Unknown property 'zoom'. Declaration dropped. timeline.3fb0c4c981cd3f8f8dfb6b0ab93d6a9e.default.css:1
Expected declaration but found '*'. Skipped to next declaration. timeline.3fb0c4c981cd3f8f8dfb6b0ab93d6a9e.default.css:1
Error in parsing value for 'background-image'. Declaration dropped. timeline.3fb0c4c981cd3f8f8dfb6b0ab93d6a9e.default.css:1
Expected color but found 'top'. Error in parsing value for 'background-image'. Declaration dropped. timeline.3fb0c4c981cd3f8f8dfb6b0ab93d6a9e.default.css:1
window.controllers is deprecated. Do not use it for UA detection. nsHeaderInfo.js:412
GET https://syndication.twitter.com/widgets/timelines/paged/529143195632795648 [HTTP/1.1 200 OK 381ms]
// SNIPPET:
<div class=\"row\">
<div class=\"col-md-4 col-md-push-8\">
<div class=\"inner\">
<a class=\"twitter-timeline\" href=\"https://twitter.com/parasclasses\" data-widget-id=\"529143195632795648\">Tweets by @Html.Raw(\"@parasclasses\")</a>
<script>
!function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + \"://platform.twitter.com/widgets.js\";
fjs.parentNode.insertBefore(js, fjs);
}
}(document, \"script\", \"twitter-wjs\");
</script>
</div>
</div>
<div class=\"col-md-8 col-md-pull-4\">
<p>Website under construction will be updated soon!</p>
</div>
</div>
// SNIPPET:
fullscreenOn
// SNIPPET:
fullscreenOff
// SNIPPET:
var elem = document.getElementById(\"myvideo\");
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
}
// SNIPPET:
function Reportdate(txt, keyCode) {
alert(txt);
if (keyCode == 8) { txt.value = substr(0, txt.value.length - 1); return; }
var dt = txt.value;
var da = dt.split('-');
for (var a = 0; a < da.length; a++) { if (da[a] != +da[a]) da[a] = da[a].substr(0, da[a].length - 1); }
if (da[0] > 9999) da[1] = da[0].substr(0, da[0].length - 1);
if (da[1] > 12) { da[2] = da[1].substr(da[1].length - 1, 1); da[1] = '0' + da[1].substr(0, da[1].length - 1); }
if (da[2] > 31) { da[1] = da[2].substr(da[2].length - 1, 1); da[2] = '0' + da[2].substr(0, da[2].length - 1); }
dt = da.join('-');
if (dt.length == 2 || dt.length == 5) dt += '-';
txt.value = dt;
}
// SNIPPET:
<asp:TextBox ID=\"txtFromDate\" onkeydown = \"return Reportdate(this, event.keyCode)\" runat=\"server\"></asp:TextBox>
// SNIPPET:
var buttons = document.getElementsByName(\"signupButton\");
console.log(buttons);
// SNIPPET:
[item: function]
0: button.btn.btn-warning.btn-lg
1: button.btn.btn-warning.btn-lg
2: button.btn.btn-warning.btn-lg
length: 3
__proto__: NodeList
// SNIPPET:
<span id=\"[name of option]\" style=\"display:none\">[content of tooltip]</span>
// SNIPPET:
$(document).ready(function() {
$(\".productAttributeValue\").each(function() {
var optionLabel = $(this).siblings('div');
var optionLabelText = optionLabel.children(\"label\").children(\"span.name\").text();
if ($(\"img\", this).length < 1) {
$(this).siblings('div')
.children(\"label\")
.children(\"span.name\")
.append(\"&nbsp;<div class='help_div' style='display: inline;'><img src='/product_images/uploaded_images/help.gif' alt='\" + optionLabelText + \"'/></div>\");
}
});
$('.help_div').each(function() {
var slug = slugify($(\"img\", this).prop('alt'));
var html = $(\"#\" + slug).html();
var titleq = $(\"img\", this).prop('alt').replace(/[^-a-zA-Z0-9,&\\s]+/ig, '');
titleq = \"<strong style='font-size: 12px'>\" + titleq + \"</strong><br/>\"
if (!html) html = \"Description not available yet.\"
$(this).qtip({
content: titleq + html,
position: {
corner: {
tooltip: 'topRight',
target: 'bottomLeft'
}
},
style: {
tip: {
corner: 'rightTop',
color: '#6699CC',
size: {
x: 15,
y: 9
}
},
background: '#6699CC',
color: '#FFFFFF',
border: {
color: '#6699CC',
}
}
});
});
function slugify(text) {
text = text.replace(/[^-a-zA-Z0-9,&\\s]+/ig, '');
text = text.replace(/-/gi, \"_\");
text = text.replace(/^\\s+|\\s+$/g, \"\");
text = text.replace(/\\s/gi, \"-\");
text = text.toLowerCase();
return text;
}
});
// SNIPPET:
function toggle_select(id) {
// the id number that is passed is the primary key value for the database record
alert('id '+id+' was clicked'); //this part works, but how to pass the new state to this script?
// ?? can the function read if the checkbox has been checked or unchecked?
// if so, then run a background process (ie. php script?) to update that record to the new checked or unchecked state
// ie. $sql=\"update recordtable set is_selected='YES/NO' where rec_ID=id limit 1\";
};
// SNIPPET:
<table>
<tr><th colspan=\"2\">SELECT REQUIRED RECORDS</th></tr>
<tr><td><input type=\"checkbox\" name=\"is_selected\" checked onclick=\"toggle_select(1)\" /></td><td>Record 1</td></tr>
<tr><td><input type=\"checkbox\" name=\"is_selected\" onclick=\"toggle_select(2)\" /></td><td>Record 2</td></tr>
<tr><td><input type=\"checkbox\" name=\"is_selected\" checked onclick=\"toggle_select(3)\" /></td><td>Record 3</td></tr>
<tr><td><input type=\"checkbox\" name=\"is_selected\" checked onclick=\"toggle_select(4)\" /></td><td>Record 4</td></tr>
<tr><td><input type=\"checkbox\" name=\"is_selected\" onclick=\"toggle_select(5)\" /></td><td>Record 5</td></tr>
<tr><td><input type=\"checkbox\" name=\"is_selected\" onclick=\"toggle_select(6)\" /></td><td>Record 6</td></tr>
</table>
// SNIPPET:
$('#btnSearch').on('click', function (e) {
window.textbox = $('#q').val();
window.searchType = $('input:radio[name=source]:checked').val();
popupCenter(\"movielist.php\",\"_blank\",\"400\",\"400\");
});
// SNIPPET:
<td><a href=\"http://www.imdb.com/title/<?php echo urlencode($row['ImdbId']); ?>\"><?php echo $row['movieName']; ?></a></td>
// SNIPPET:
for(var i = 0; i < myJSONData.length; i++) {
// do stuff with myJSONData[i]
}
// SNIPPET:
var myJSONData = [/* array of objects */];
var myFunc = function() {
for(var i = 0; i < myJSONData.length; i++) {
// do stuff with myJSONData[i]
}
}
var anotherFunc = function() {
for(var i = 0; i < myJSONData.length; i++) {
// do different stuff with myJSONData[i]
}
}
// SNIPPET:
<!DOCTYPE HTML>
<html>
<head>
<title>World Wide Web</title>
<link rel=\"stylesheet\" href=\"css/style.css\" type=\"text/css\">
</head>
<body>
<script src=\"//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>
<script src=\"java.js\"></script>
<div id=\"header\">
<div>
<div class=\"logo\">
<a href=\"#index\">Profect WWW</a>
</div>
<ul id=\"navigation\">
<li class=\"active\">
<a href=\"#index\">What</a>
</li>
<li>
<a href=\"#who\">Who</a>
</li>
<li>
<a href=\"#how\">How</a>
</li>
<li>
<a href=\"#when\">When</a>
</li>
<li>
<a href=\"#awesome\">Awesome!</a>
</li>
</ul>
</div>
</div>
<div id=\"adbox\">
<div class=\"clearfix\">
<img src=\"images/box.png\" alt=\"Img\" height=\"342\" width=\"368\">
<div>
<h1>WW What?</h1>
<h2>Project World Wide Web.</h2>
<p>
The World Wide Web (abbreviated as WWW or W3, commonly known as the Web) is a system of interlinked hypertext documents that are accessed via the Internet. With a web browser, one can view web pages that may contain text, images, videos, and other multimedia and navigate between them via hyperlinks. <span><a href=\"index.html\" class=\"btn\">Explore!</a><b>Don’t worry it’s for free</b></span>
</p>
</div>
</div>
</div>
<div id=\"contents\">
<div id=\"tagline\" class=\"clearfix\">
<h1 id=\"whomade\">Who made it ? O.o</h1>
<section id=\"who\">
<div>
<p>
Tim Berners-Lee, a British computer scientist and former CERN employee,and Belgian computer scientist Robert Cailliau are considered the inventors of the Web.
</p>
<p>
On March 12, 1989, Berners-Lee wrote a proposal for what would eventually become the World Wide Web.</p>
<p>
The 1989 proposal was meant for a more effective CERN communication system but Berners-Lee eventually realised the concept could be implemented throughout the world.
</p>
</div>
<div>
<p>
Berners-Lee and Belgian computer scientist Robert Cailliau proposed in 1990 to use hypertext \"to link and access information of various kinds as a web of nodes in which the user can browse at will\",and Berners-Lee finished the first website in December of that year.
</p>
<p>
The first test was completed around 20 December 1990 and Berners-Lee reported about the project on the newsgroup alt.hypertext on 7 August 1991.
</p>
<p>
Wix is an online website builder with a simple drag & drop interface, meaning you do the work online and instantly publish to the web.
</p>
</div>
</section>
</div>
<div id=\"slider-wrapper\">
<div class=\"inner-wrapper\">
<input checked type=\"radio\" name=\"slide\" class=\"control\" id=\"Slide1\"/>
<label for=\"Slide1\" id=\"s1\"></label>
<input type=\"radio\" name=\"slide\" class=\"control\" id=\"Slide2\"/>
<label for=\"Slide2\" id=\"s2\"></label>
<input type=\"radio\" name=\"slide\" class=\"control\" id=\"Slide3\"/>
<label for=\"Slide3\" id=\"s3\"></label>
<input type=\"radio\" name=\"slide\" class=\"control\" id=\"Slide4\"/>
<label for=\"Slide4\" id=\"s4\"></label>
<div class=\"overflow-wrapper\">
<a class=\"slide\" href=\"\"><img src=\"http://i.imgur.com/hKju1EC.jpg\"/></a>
<a class=\"slide\" href=\"\"><img src=\"http://i.imgur.com/hKju1EC.jpg\"/></a>
<a class=\"slide\" href=\"\"><img src=\"http://i.imgur.com/hKju1EC.jpg\"/></a>
<a class=\"slide\" href=\"\"><img src=\"http://i.imgur.com/hKju1EC.jpg\"/></a>
</div>
</div>
</div>
</div>
<div id=\"footer\">
<div class=\"clearfix\">
<div id=\"connect\">
<a href=\"http://freewebsitetemplates.com/go/facebook/\" target=\"_blank\" class=\"facebook\"></a><a href=\"http://freewebsitetemplates.com/go/googleplus/\" target=\"_blank\" class=\"googleplus\"></a><a href=\"http://freewebsitetemplates.com/go/twitter/\" target=\"_blank\" class=\"twitter\"></a><a href=\"http://www.freewebsitetemplates.com/misc/contact/\" target=\"_blank\" class=\"tumbler\"></a>
</div>
<p>
© 2025 Dark Virtuality.
</p>
</div>
</div>
</body>
</html>
// SNIPPET:
$(document).ready(function(){
$('a[href^=\"#\"]').on('click',function (e) {
e.preventDefault();
var target = this.hash;
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 900, 'swing', function () {
window.location.hash = target;
});
});
});
// SNIPPET:
var canvas = document.getElementById(\"canvas\");
var stage = new createjs.Stage(canvas);
canvas.width = 500;
canvas.height = 500;
var midx = 250;
var midy = 250;
var radius = 200;
var angle = 0;
var count = 30;
var step = 2 * Math.PI / count;
var xpos;
var ypos;
var nodeSize;
var node = function(size){
var dot = new createjs.Shape();
dot.graphics.beginFill(\"#000\").drawCircle(0, 0, size);
dot.x = dot.y = -5;
dot.alpha = .25;
return dot
};
for(var i = 0; i<count; i++)
{
xpos = radius * Math.cos(angle) + midx;
ypos = radius * Math.sin(angle) + midx;
nodeSize = i;
var n = new node(nodeSize);
n.x = xpos;
n.y = ypos;
stage.addChild(n)
angle += step;
}
stage.update();
// SNIPPET:
keywords
// SNIPPET:
TypeError: $(...).dialog is not a function
$(\"#dialog_keywords\").dialog('open').load(\"getKeywords.php\");
// SNIPPET:
<script>
var $ad_keywords;
var $totalkeywords = 0;
$( \"#dialog_keywords\" ).dialog({
autoOpen: false,
width: 1160,
height: 450,
buttons: [
{
text: \"Ok\",
click: function() {
var selected_keywords = new Array(\"\");
var z = 0;
for(xxrow = 0; xxrow < $totalkeywords; xxrow++)
{
if($('#keyword_'+xxrow).hasClass(\"keywordHighlight2\")){
selected_keywords[z] = $('#keyword_'+xxrow).html();
z++;
}
}
selected_keywords.sort()
$(\"#ad_keyword\").val(selected_keywords);
$( this ).dialog( \"close\" );
}
},
{
text: \"Cancel\",
click: function() {
$( this ).dialog( \"close\" );
}
}
]
});
var keywordinit = 0;
$( \"#ad_keyword\" ).click(function( event ) {
$ad_keywords = $(\"#ad_keyword\").val().split(',');
if(keywordinit == 0){
keywordinit = 1;
$('#dialog_keywords').css('overflow', 'hidden');
$(\"#dialog_keywords\").dialog('open').load(\"getKeywords.php\");
}
else{
$(\"#dialog_keywords\").dialog('open');
}
event.preventDefault();
});
</script>
// SNIPPET:
<script src=\"http://code.jquery.com/jquery-1.11.1.min.js\"></script>
<script src=\"http://code.jquery.com/ui/1.11.1/jquery-ui.min.js\"></script>
<script src=\"include/function.js\" type=\"text/javascript\"></script>
<link rel=\"stylesheet\" href=\"//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css\">
// SNIPPET:
var postcodes =
[
{ postcode: \"BT486AA1\", place: \"Londonderry Park, Londonderry\", dates: [\"16/05/2014\", \"18/06/2014\", \"19/07/2014\"] },
{ postcode: \"BT486AB1\", place: \"Londonderry Park, Londonderry\", dates: [\"17/05/2014\", \"11/06/2014\"] },
{ postcode: \"BT486AD1\", place: \"Londonderry Park, Londonderry\", dates: [\"14/05/2014\", \"20/06/2014\"] },
{ postcode: \"BT486EL1\", place: \"Londonderry Park, Londonderry\", dates: [\"16/05/2014\", \"18/06/2014\", \"19/07/2014\"] },
{ postcode: \"BT171JR6\", place: \"Londonderry Park, Londonderry\", dates: [\"17/05/2014\", \"11/06/2014\"] },
{ postcode: \"BT171JR7\", place: \"Ballyregan Park, Londonderry\", dates: [\"14/05/2014\", \"20/06/2014\"] },
{ postcode: \"BT171JR1\", place: \"Ballyregan Park,Londonderry\", dates: [\"16/05/2014\", \"18/06/2014\", \"19/07/2014\"] },
{ postcode: \"BT171JR2\", place: \"Ballyregan Park, Londonderry\", dates: [\"17/05/2014\", \"11/06/2014\"] },
{ postcode: \"BT181JR3\", place: \"Ormeau Park, Londonderry\", dates: [\"14/05/2014\", \"20/06/2014\"] },
{ postcode: \"BT181JR4\", place: \"Ormeau Park, Londonderry\", dates: [\"16/05/2014\", \"18/06/2014\", \"19/07/2014\"] },
{ postcode: \"BT191JR6\", place: \"Main Street, Londonderry\", dates: [\"17/05/2014\", \"11/06/2014\"] },
{ postcode: \"BT191JR7\", place: \"Main Street, Londonderry\", dates: [\"14/05/2014\", \"20/06/2014\"] }
];
function RegisterUser() {
for (var i = 0; i < postcodes.length; i++) {
var postCode = document.getElementById(\"pc2\").value;
if (postcodes[i].postcode === postCode) {
alert(\"The postcode you entered is already registered\");
}
else {
AddUser();
}
}
}
function AddUser() {
var postCode2 = document.getElementById(\"pc2\").value
var newUser = postcodes[i].postcode;
for (var i = 0; i < postcodes.length; i++) {
if (newUser.indexOf(postCode2) === -1) {
postcodes[i].postcode.push(postCode2);
alert(\"Postcode Registered : \" + postCode2 + \" Smart Waste Management Scheme will be in contact regarding your step towards smart waste\");
}
}
}
// SNIPPET:
<script type=\"text/javascript\">
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
GetArticlesFromNextSection(true);
}
});
var i = 2;
function GetArticlesFromNextSection(scrollPage) {
var pagenumber = i++;
$(\"#divLoading\").show();
setTimeout(function () {
$.post('/Channel/MessagePagination', {
\"pagenumber\": pagenumber,
},
function (data) {
if (data == \"\") {
$(\"#divLoading\").html(\"No More Posts\");
}
$(\"#messagelist\").append(data);
$(\"#divLoading\").hide();
});
}, 1000);
i = i;
}
</script>
// SNIPPET:
if (data == \"\") { $(\"#divLoading\").html(\"No More Posts\");}
// SNIPPET:
@Html.AntiForgeryToken()
<div>
@Html.ValidationSummary(true)
<div id=\"messagelist\">
@{Html.RenderPartial( \"mypartial\",list);}
</div>
</div>
<div id=\"divLoading\" style=\"margin: 0px; padding: 0px; position: fixed; right: 0px; top: 0px; width: 100%; height: 100%; background-color: #666666; z-index: 30001; opacity: .8; filter: alpha(opacity=70);display:none\">
<p style=\"position: absolute; top: 30%; left: 45%; color: White;\">Loading, please wait...<img src=\"~/images/loading.png\"></p>
</div>
// SNIPPET:
public ActionResult MessagePagination(int pagenumber)
{
var balObject = new BusinessLogic();
int pageSize = 3;
var MessageList = balObject.FetchMessages();
MessageList = MessageList.Skip((pagenumber - 1) * pageSize).Take(pageSize).ToList();
return PartialView(\"mypartial\", MessageList);
}
// SNIPPET:
<script type='text/javascript'>
$(window).load(function(){
$(function() {
$(\".draggable\").draggable();
$(\".item\").droppable({
drop: function(event, ui) {
var $this = $(this);
$this.append(ui.draggable);
var width = $this.width();
var height = $this.height();
var cntrLeft = (width / 2) - (ui.draggable.width() / 2);
var cntrTop = (height / 10) - (ui.draggable.height() /10);
ui.draggable.css ({
left: cntrLeft + \"px\",
top: cntrTop + \"px\"
});
count += $(\".draggable\").attr(\"rating\");
alert(count);
}
});
});
$(\"#box_1\").text(count);
});
</script>
</head>
<body>
<div class=\"item\">
<div class=\"draggable\" rating=\"2\">Text #1 <input style =\"display: inline; width: 20px; float: right;\" type=\"text\" name=\"quantity\" value=\"1\" /></div>
<div class=\"draggable\" rating=\"1\">Text #2 <input style =\"display: inline; width: 20px; float: right;\" type=\"text\" name=\"quantity\" value=\"1\" /></div>
<div class=\"draggable\" rating=\"1\">Text #3 <input style =\"display: inline; width: 20px; float: right;\" type=\"text\" name=\"quantity\" value=\"1\" /></div>
<div class=\"draggable\" rating=\"1\">Text #4 <input style =\"display: inline; width: 20px; float: right;\" type=\"text\" name=\"quantity\" value=\"1\" /></div>
<div class=\"draggable\" rating=\"1\">Text #5 <input style =\"display: inline; width: 20px; float: right;\" type=\"text\" name=\"quantity\" value=\"1\" /></div>
</div>
<div class=\"item\">
Total = <div id=\"box_1\"></div>
</div>
<div class=\"item\">
</div>
</body>
// SNIPPET:
<script src=\"script.js\"></script>
// SNIPPET:
function err(errRep) {
alert(errRep);
}
function next(){
document.getElementsByClassName('another').style.backgroundColor=#8CDD81;
}
// SNIPPET:
bower
// SNIPPET:
bower
// SNIPPET:
bower
// SNIPPET:
gulp build
// SNIPPET:
\"jquery\": \"<=2.1.0\"
// SNIPPET:
\"jquery\": \"^2.1.0\"
// SNIPPET:
2.1.1
// SNIPPET:
<=
// SNIPPET:
finalize = function() {
var tableData = \"\";
$('#results').find('tr').each(function() {
var row = $(this);
if (row.find('input[type=\"checkbox\"]').is(':checked')) {
tableData = tableData + $(this).find('td:first').text() + '\\n'; // get ID
}
});
//var myRows = JSON.parse(tableData);
//$.post(\"/Journal/SaveEntry\", { Row: myRows });
alert(tableData);
};
// SNIPPET:
<script src=\"https://github.com/maxazan/jquery-treegrid/blob/master/js/jquery.treegrid.js\"></script>
<script src=\"https://github.com/maxazan/jquery-treegrid/blob/master/js/jquery.treegrid.bootstrap3.js\"></script>
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>
<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css\">
<table class=\"table tree truncate_table\">
<tbody>
<tr class=\" info\">
<th>Row ID</th>
<th>...</th>
<th>Finalize</th>
</tr>
<tr class=\"treegrid-1\">
<td>
<span class=\"treegrid-expander\"></span>
R4915
</td>
<td>...</td>
<td>
<input type=\"checkbox\" name=\"Finalize\" value=\"Finalize\">
</td>
</tr>
<tr class=\"treegrid-2\">
<td>
<span class=\"treegrid-expander\"></span>
<a target=\"_blank\" href=\"http://example.com\" class=\"vt-p\">
R4942
</a>
</td>
<td>...</td>
<td>
<input type=\"checkbox\" name=\"Finalize\" value=\"Finalize\">
</td>
</tr>
</tbody>
</table>
<button onclick=\"finalize()\" type=\"button\" class=\"btn btn-danger pull-right\">Finalize</button>
// SNIPPET:
jwplayer
// SNIPPET:
<script src=\"http://jwpsrv.com/library/XXzG4ndHEeS3EA6sC0aurw.js\"></script>
<script>
$(document).ready(function() {
jwplayer(\"cover\").setup({
file: \"rtmp://199.59.88.39/cam4-cr107/130.flv\",
image: \"start.png\",
height: 360,
width: 640
});
});
</script>
// SNIPPET:
$(document).ready(function() {
Date.prototype.dateToString = function() {
var yyyy = this.getFullYear().toString();
var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
var dd = this.getDate().toString();
return yyyy + '-' + (mm[1]?mm:\"0\"+mm[0]) + '-' + (dd[1]?dd:\"0\"+dd[0]); // padding
};
var d = new Date();
var date = d.dateToString();
$.ajax({
dataType: \"json\",
url: url
}).then(function(data){
var latitude = data.geonames[0].lat;
var longitude = data.geonames[0].lng;
var north = parseFloat(latitude) + 1;
var south = parseFloat(latitude) - 1;
var east = parseFloat(longitude) + 1;
var west = parseFloat(longitude) - 1;
var uri = encodeURI(\"http://api.geonames.org/earthquakesJSON?north=\" + north + \"&south=\" + south + \"&east=\" + east + \"&west=\" + west + \"&date=\" + date +\"&username=demo\");
$.ajax({
dataType: \"json\",
url: uri
}).then(function(eData){
var myLatlng = new google.maps.LatLng(parseFloat(data.geonames[0].lat), parseFloat(data.geonames[0].lng));
function initialize() {
var mapProp = {
center : myLatlng,
minzoom: 1,
maxzoom: 20,
zoom : 7,
mapTypeId : google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById(\"googleMap\"),
mapProp);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Search Location\\nLatitude: ' + data.geonames[0].lat + '\\nLongitude: ' + data.geonames[0].lng
});
for(item = 0; item < eData.earthquakes.length; item++){
if (eData.earthquakes.length > 0){
var eLat = eData.earthquakes[item].lat, eLng = eData.earthquakes[item].lng;
} else {
var eLat = '', eLng = '';
}
new google.maps.Marker({
position: new google.maps.LatLng(eLat,eLng),
map: map,
title: 'Date and Time: '+eData.earthquakes[item].datetime+'\\nMagnitude: '+eData.earthquakes[item].magnitude+'\\nDepth: '+eData.earthquakes[item].depth+'\\nLat: '+eData.earthquakes[item].lat+'\\nLong: '+eData.earthquakes[item].lng
});
}
}
initialize();
});
});
});
// SNIPPET:
function getSearch(url){
$(document).ready(function() {
Date.prototype.dateToString = function() {
var yyyy = this.getFullYear().toString();
var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
var dd = this.getDate().toString();
return yyyy + '-' + (mm[1]?mm:\"0\"+mm[0]) + '-' + (dd[1]?dd:\"0\"+dd[0]); // padding
};
var d = new Date();
var date = d.dateToString();
$.ajax({
dataType: \"json\",
url: url
}).then(function(data){
var latitude = data.geonames[0].lat;
var longitude = data.geonames[0].lng;
var north = parseFloat(latitude) + 1;
var south = parseFloat(latitude) - 1;
var east = parseFloat(longitude) + 1;
var west = parseFloat(longitude) - 1;
var uri = encodeURI(\"http://api.geonames.org/earthquakesJSON?north=\" + north + \"&south=\" + south + \"&east=\" + east + \"&west=\" + west + \"&date=\" + date +\"&username=demo\");
$.ajax({
dataType: \"json\",
url: uri
}).then(function(eData){
var myLatlng = new google.maps.LatLng(parseFloat(data.geonames[0].lat), parseFloat(data.geonames[0].lng));
function initialize() {
var mapProp = {
center : myLatlng,
minzoom: 1,
maxzoom: 20,
zoom : 7,
mapTypeId : google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById(\"googleMap\"),
mapProp);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Search Location\\nLatitude: ' + data.geonames[0].lat + '\\nLongitude: ' + data.geonames[0].lng
});
for(item = 0; item < eData.earthquakes.length; item++){
if (eData.earthquakes.length > 0){
var eLat = eData.earthquakes[item].lat, eLng = eData.earthquakes[item].lng;
} else {
var eLat = '', eLng = '';
}
new google.maps.Marker({
position: new google.maps.LatLng(eLat,eLng),
map: map,
title: 'Date and Time: '+eData.earthquakes[item].datetime+'\\nMagnitude: '+eData.earthquakes[item].magnitude+'\\nDepth: '+eData.earthquakes[item].depth+'\\nLat: '+eData.earthquakes[item].lat+'\\nLong: '+eData.earthquakes[item].lng
});
}
}
initialize();
});
});
});
}
// SNIPPET:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote
resource at http://api.geonames.org/searchJSON?q=Fukushima&maxRows=10&username=demo.
This can be fixed by moving the resource to the same domain or enabling CORS.
// SNIPPET:
<form action=\"form_action.php\" method=\"Post\">
<select name=\"cars[]\" multiple id=\"select_id\">
<option value=\"all\" id=\"option_id\">All</option>
<option value=\"volvo\">Volvo</option>
<option value=\"saab\">Saab</option>
<option value=\"opel\">Opel</option>
<option value=\"audi\">Audi</option>
</select>
<input type=\"submit\">
</form>
// SNIPPET:
<script>
$(document).ready(function()
{
$('#option_id')
.click(
function()
{
if ($(\"#select_id option[value='all']\").length == 0) { //value does not exist so add
//Do something if not selected
}
else
{
//DO something if selected
}
//$(\"#select_id option:selected\").removeAttr(\"selected\"); //Remove
//$(\"#select_id option\").attr('selected', 'selected'); //Add
}
);
});
</script>
// SNIPPET:
var w1 = {warframeName:\"Ash\", health:450, shield:300, power:150, armor:65.0, sprint:1.15, stamina:100, image:\"images/warframes/ash.jpg\"};
$(\".woption\").click(function() {
var wClass = $(this).attr('class').split(' ')[0];
for(var x = 1; x <23; x++) {
if(wClass == \"w\"+x) {
$(\".warframe_selector\").css(\"background\", \"url(\" + ('w'+x).image +\") no-repeat\", \"important\");
$(\".warframe_selector\").css( \"background-size\", \"100%\" );
} else {}
}
$(\"#cover\").fadeOut(function() {});
$(\".warframe_option\").fadeOut(function() {});
});
// SNIPPET:
var http = new XMLHttpRequest();
var url = \"get_data.php\";
var params = \"bac=\"+pa+\"&seid=\"+psid+\"&wh=\"+height;
http.open(\"POST\", url, true);
// SNIPPET:
var xmlhttp; //Defining the \"xmlhttp\" variable
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest()
} else {
xmlhttp = new ActiveXObject(\"Microsoft.XMLHTTP\")
}
xmlhttp.onreadystatechange = function() { //If the xmlhttp is created then do this:
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { //Don't know
fired = true; //The function gathered the conditions to start
var title = '<div id=\"message_box_title_unavailable\">woops!</div>'; //Doesn't matter
var result; //Variable \"result\"
if (xmlhttp.responseText == 'available') { //If the xml file contains \"available\" on it then do this, else return an error...
result = 'The name you selected <strong>' + user + 'is available!'
} else {
result = 'There was an error processing your request. Please try again.'
}
}
};
xmlhttp.open(\"POST\", \"Checkusername.php\", true); //Didn't I translate this correctly?
xmlhttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\"); //What am I missing from this line in my vb code?
xmlhttp.send(\"name=\" + name + \"&n=\" + Math.random()) //The same...
}
// SNIPPET:
Dim req As HttpWebRequest
Dim res As HttpWebResponse
Dim cookies As New CookieContainer()
req = WebRequest.Create(\"http://blablabla.net/Checkusername.php?name=\" & name \"&n=\" R.Next(0, 20000))
req.Method = \"POST\"
req.ContentType = \"application/xml\"
req.Headers.Add(\"Content-type\", \"application/x-www-form-urlencoded\")
req.CookieContainer = cookies
res = req.GetResponse
Dim webStream As Stream
webStream = res.GetResponseStream
Dim reader As New StreamReader(webStream)
checksource.text = reader.readtoend
// SNIPPET:
$('#submit').click(function(){
var data;
var title = $('#dimTableTitle td').html();
data = '<table id=\"dimTable\">';
data += '<tbody>';
data += '<tr id=\"dimTableTitle\">' + '<td colspan=\"100\">' + title + '</td>' + '</tr>'
data += '<tr id=\"dimHeading\">';
$(\"#dimHeading\").find('td').each(function(){
data += '<td>' + $(this).html() + '</td>';
});
$('#dimTable tr').has(':checkbox:checked').each(function(){
data += '<tr>'
$(this).find('td').each(function(){
data += '<td>' + $(this).html(); + '</td>'
});
data += '</tr>'
});
data += '</tr>'
data += '</tbody>';
data += '</table>';
});
// SNIPPET:
gulpfile.js
// SNIPPET:
var gulp = require('gulp'),
concat = require('gulp-concat'),
less = require('gulp-less'),
minifyCSS = require('gulp-minify-css'),
uglify = require('gulp-uglify'),
autoprefixer = require('gulp-autoprefixer');
gulp.task('less', function () {
gulp.src(['less/*.less'])
.pipe(less())
.pipe(concat('everything.css'))
.pipe(autoprefixer())
.pipe(minifyCSS())
.pipe(gulp.dest('asset/'));
});
gulp.task('js', function () {
gulp.src(['javascript/*.js'])
.pipe(concat('everything.js'))
.pipe(uglify())
.pipe(gulp.dest('asset/'));
});
gulp.task('watch', function() {
gulp.watch('javascript/*.js', ['js']);
gulp.watch('less/*.less', ['less']);
});
// SNIPPET:
less
// SNIPPET:
var x = new Image();
Object.observe(x, function(){console.log('i never run');})
x.src = 'http://www.foo.com';
console.log('has been set: ' + x.src);
// SNIPPET:
var x = new function nonNative(){};
Object.observe(x, function(){console.log('i will run');})
x.src = 'http://www.foo.com';
// SNIPPET:
var x = new XMLHttpRequest();
Object.observe(x, function(){console.log('so will i');})
x.src = 'http://www.foo.com';
// SNIPPET:
document.getElementById(id).innerHTML = text;
// SNIPPET:
this.$el.find('.findall').on('click', function(e) { ... });
// SNIPPET:
<ol class=\"chapter-list\" style=\"width: 469px\">
<li data-time=\"0\" id=\"0\"><span style=\"display: inline-block; width: 88%;\">Chapter 1</span></li>
<li data-time=\"104\" id=\"104\"><span style=\"display: inline-block; width: 88%;\">Chapter 2</span></li>
<li data-time=\"235\" id=\"235\"><span style=\"display: inline-block; width: 88%;\">Chapter 3</span></li>
<li data-time=\"309\" id=\"309\"><span style=\"display: inline-block; width: 88%;\">Chapter 4</span></li>
<li data-time=\"406\" id=\"406\"><span style=\"display: inline-block; width: 88%;\">Chapter 5</span></li>
</ol>
<div id=\"mydiv\"></div>
// SNIPPET:
angular.element($document[0].querySelector(\"table > tbody > tr\")).mouseover().css(\"background-color\", \"red\");
// SNIPPET:
<table>
<thead>
<tr>
<th>Name</th>
<th>Phone</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr ng-repeat=\"person in contacts | filter:search| offset:currentPage*pageSize| limitTo:pageSize
|orderBy:'name' \">
<td>{{ person.name }}</td>
<td>{{ person.phone }}</td>
<td>{{ person.email }}</td>
</tr>
</tbody>
// SNIPPET:
var i;
for(i = 1; i < 31; i++){
var nDate = \"DateJan\" + i;
document.getElementById('FIELD_'+ (FieldIDs[nDate]).value = \"test\";
}
// SNIPPET:
document.getElementById('FIELD_'+ (FieldIDs[nDate]).value = \"test\";
// SNIPPET:
var width = 0;
$('#checkbox1').change(function() {
if($(this).is(\":checked\")) {
width+=5;
}
else{
width-=5;
}
//this is the code that i want it run after any of checkboxes clicked
if (width <= 25){do something}
if ( width > 25 && width <= 50){do something}
if ( width > 50 && width <= 75){do something}
if ( width > 75 && width <= 100){do something}
});
// SNIPPET:
var x = false;
if (!!x) { // syntactic sugar for x ! =undefined
alert('I will not be shown');
}
// SNIPPET:
var result = $.ajax({
url: '/r/'+action,
type: 'POST',
data: post_data,
context: data,
dataType: 'json',
// SNIPPET:
<div id=\"leaf\" style\"width:50px\">
<ul>
<li>This is the first jstree leaf for testing</li>
<li>this is the second jstree leaf</li>
<li>this is third</li>
</ul>
</div>
// SNIPPET:
<div class=\"loremipsum\">
<h3>Contact Us</h3>
<p>We would love to here from you.So,just leave a email.</p>
<div id=\"facebook-logo\"><a href=\"http://facebook.com/joomgame\"></a></div>
</div>
// SNIPPET:
#facebook-logo{
background:url('facebook-logo.png') no-repeat 0 0;
}
#facebook-logo:hover{
background:url('facebook-logo-negative.png') no-repeat 0 -100px;
}
// SNIPPET:
$('button').on('click', initPlumb);
// SNIPPET:
def index
redirect_to www.google.com
end
// SNIPPET:
<html ng-app>
<head>
<title></title>
<script src=\"Scripts/angular.js\"></script>
<script src=\"app.js\"></script>
</head>``
<body ng-controller=\"MainCtrl\">
<div>Hello, {{userGroup.name}}!</div>
</body>
</html>
// SNIPPET:
app.js
// SNIPPET:
var MainCtrl = function ($scope) {
$scope.userGroup = {
name: \"Kirill Kuts\"
};
}
// SNIPPET:
define(function (require) {
var ExternalJSInterface = require(\"./../../utils/ExternalJSInterface\");
var ExternalJSXInterface = require(\"jsx!ExternalJSXInterface\");
}
// SNIPPET:
allow-file-access-from-files
// SNIPPET:
<ul id=\"filter\">
<li style=\"list-style-type: none\" class=\"all\"><a href=\"#\">all</a>
</li>
<br>
<li style=\"list-style-type: none\" class=\"people\"><a href=\"#people\">people</a>
</li>
<br>
<li style=\"list-style-type: none\" class=\"things\"><a href=\"#things\">things</a>
</li>
<br>
</ul>
</div>
<!-- end affix -->
</div>
<!-- container -->
<div id=\"visible-container\">
<div class=\"col-xs-10 col-xs-push-1 col-sm-9 col-sm-push-2 col-md-10 col-lg-7 col-lg-push-3\" style=\"padding-left:5px\">
<ul id=\"portfolio\">
<li class=\"people\"><a href=\"portfolio/people1.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/140220_MabelFlwrCrwn_056.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people1.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/140220_MabelFlwrCrwn_129.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people2.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/131017_FlowerWall_215.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people2.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/131017_FlowerWall_233.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people3.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/130907_3DayPortraits_151.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people3.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/130907_3DayPortraits_140.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"things\"><a href=\"portfolio/things4.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/things/130712_PeachWedding_147.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"things\"><a href=\"portfolio/things4.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/things/130712_PeachWedding_065.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people4.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/130331_ScotlandEaster_090.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people4.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/130331_ScotlandEaster_095.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people5.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/120830_SeattlePics_411.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people5.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/130813_ScotlandTrip_110.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people6.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/140318_KirstyGrieve_235.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people6.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/140318_KirstyGrieve_391.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people7.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/260913_HelenPatrick_208b.jpg\" width=\"185\" height=\"185\"></a>
</li>
<li class=\"people\"><a href=\"portfolio/people7.html\"><img class=\"lazy\" data-original=\"http://megmackayphoto.com/lib/img/thumbs/people/260913_HelenPatrick_162.jpg\" width=\"185\" height=\"185\"></a>
</li>
</ul>
</div>
</div>
</div>
</div>
// SNIPPET:
<div ng-controller=\"IndexController\">
<button class=\"button button-block button-assertive\" ng-click=\"button1()\" value=\"checkitems\" >
Button1
</button>
<button class=\"button button-block button-assertive\" ng-click=\"button2()\" value=\"checkitems\" >
Button2
</button>
</div>
// SNIPPET:
angular
.module('legeApp')
.controller('IndexController', function($scope, supersonic, $filter) {
$scope.test = 'test';
$scope.button1= function(){
$scope.test= 'button1';
var view = new supersonic.ui.View(\"legeApp#view2.html\");
var customAnimation = supersonic.ui.animate(\"flipHorizontalFromLeft\");
supersonic.ui.layers.push(view, { animation: customAnimation });
};
$scope.button2= function(){
$scope.test= 'button2';
var view = new supersonic.ui.View(\"legeApp#view2.html\");
var customAnimation = supersonic.ui.animate(\"flipHorizontalFromLeft\");
supersonic.ui.layers.push(view, { animation: customAnimation });
};
});
// SNIPPET:
<div ng-controller=\"IndexController\">
<div class=\"card\">
<div class=\"item item-text-wrap\">
Test<b>{{test}} </b>
</div>
</div>
</div>
// SNIPPET:
// Works like this with everything in one place:
app.use(express.static(path.join(__dirname, 'public')));
// What I thought I could do to serve from elsewhere:
app.use(express.static('www.mydomain.net/path/to/public'));
// SNIPPET:
$scope.changePasswordModal = function() {
angular.element('#password-change').modal('show');
};
// SNIPPET:
if(angular.isDefined($routeParams.chgkey)){
$scope.changePasswordModal();
}
// SNIPPET:
<div class=\"modal custom\" id=\"new-password-remember\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"newPasswordRemember\" aria-hidden=\"true\" modal-center modal-auto-focus modal-auto-focus-type=\"1\" modal-auto-focus-action=\"rememberpwd\" data-backdrop=\"static\">
....
// SNIPPET:
.directive('modalAutoFocus', ['$timeout', '$window', function ($timeout, $window){
return {
restrict: 'EA',
link: function(scope, element, attrs) {
if (attrs.id == 'new-password-change'){
element.find('.on-focus')[0].focus();
}
$(element).on('shown.bs.modal', function(){
element.find('.on-focus')[0].focus();
});
}
}
}]);
// SNIPPET:
function dis()
{
var primarycontactid=Xrm.Page.data.entity.attributes.get(\"primarycontactid\").getValue()[0].id;
XrmServiceToolkit.Rest.RetrieveMultiple(
\"TaskSet\",
\"?$select=Subject&$filter=RegardingObjectId/Id eq guid'+primarycontactid+'\",
function (results) {
for (var i = 0; i < results.length; i++) {
var Description = results[i].Description;
var Subject = results[i].Subject;
alert(\"Description\" + Description + \" \\n subject :\" + Subject + \"\\n success\");
}
},
function (error) {
alert(error.message);
},
true
);
}
// SNIPPET:
var bar = c3.generate({
legend: {
position: 'inset',
inset: {
x: 300,
y: 40,
}
},
data: {
columns: list,
type: 'bar',
onclick: function (d, element) { console.log(\"onclick\", d, element); },
onmouseover: function (d) { console.log(\"onmouseover\", d); },
onmouseout: function (d) { console.log(\"onmouseout\", d); },
order: \"asc\"
},
bar: {
width: {
ratio: 0.7,
//max: 50
},
},
});
// SNIPPET:
(function(){
var objects = [];
$('button.one').on('click', function(){
fetchObjects = function(objects) {
$.post(\"/fetchObjects\")
.done(function(data){
objects = data;
console.log(objects.length);
});
}
fetchObjects(objects)
});
$('button.two').on('click', function(){
console.log(objects.length);
});
})();
// SNIPPET:
objects
// SNIPPET:
button.one
// SNIPPET:
objects
// SNIPPET:
button.two
// SNIPPET:
objects
// SNIPPET:
objects
// SNIPPET:
function callback(data) {
facilities = data
}
$.post(\"/fetchObjects\")
.done(function(data){
callback(data);
});
// SNIPPET:
var PlayerSelect = React.createClass({
getPlayers: function() {
var playerNames = []
for (var i = 0; i < this.players.length; i++) {
var playerName = this.players[i].getDOMNode().value.trim();
playerNames.push(playerName);
}
this.props.setPlayers(playerNames);
},
render: function() {
this.players = []
for (var i = 0; i < this.props.numPlayers; i++) {
this.players.push(<PlayerNameInput />);
}
return (
<div className=\"page\">
<form className=\"player-select\">
<ol className=\"players\">
{this.players}
</ol>
<button onClick={this.getPlayers}>Done</button>
</form>
</div>
);
}
});
var PlayerNameInput = React.createClass({
render: function() {
return (
<li><input type=\"text\"/></li>
);
}
});
// SNIPPET:
<?php
session_start();
header(\"Cache-Control: no-store, no-cache, must-revalidate, max-age=0\");
header(\"Expires: Sat, 26 Jul 1997 05:00:00 GMT\");
$_SESSION = array();
session_destroy();
session_unset();
header(\"location:index.php\");
?>
// SNIPPET:
<html><head><script>$(document).ready(function(){
$(\"#check_user\").click(function() {
var userType=$(\"#userType\").val();
var userEmail = $(\"#log_user_email\").val();
var password = $(\"#log_password\").val();
if (userEmail==\"\" || password==\"\" || userType==\"select\"){
alert(\"empty fields !!!\");
}
else{
var dataString = 'userEmail='+ userEmail + '&password=' + password +'&userType='+userType;
$.ajax({
type: \"POST\",
url: \"check.php\",
data: dataString,
success: function(data) {
//alert(data);
if(data == \"failure\"){
alert(\"user name or password not valid.\");
return false;
}
if(data == \"success\"){
alert(\"successfuly logged in.\");
window.location='login.php';
//location.reload();
}
if(data == \"already logged in\"){
alert(\"already logged in\");
location.reload();
}
}
});
}
});
});
function logout()
{
window.location='logout.php';
}</script></head>
<body><label name=\"email\" >Email</label>
<input type=\"email\" id=\"log_user_email\" placeholder=\"example@example.com\" />
<label name=\"password\">Password</label>
<input type=\"password\" id=\"log_password\" placeholder=\"*********\"/>
<input type=\"button\" value=\"Login\" id=\"check_user\" onclick=\"check()\" style=\"cursor:pointer;\" />
<input type=\"button\" value=\"logout\" onclick=\"logout();\"></body></html>
// SNIPPET:
$scope.upload = $upload.upload({
url: BASE + 'files/tasks',
file: file,
data: data
}).success(function(data) {
for(var i = 0; i < $scope.case.task.notes.length; i++) {
if($scope.case.task.notes[i].in_api === false) {
$scope.case.task.notes[i].documents.push(data);
}
}
});
// SNIPPET:
console.log
// SNIPPET:
$scope.case.task.notes
// SNIPPET:
documents
// SNIPPET:
<div>
<p class=\"chat-file row\" ng-repeat=\"document in note.documents track by $index\">
<b class=\"pull-left col-sm-6\">
<i class=\"fa fa-file\"></i> {{document.name}}
</b>
<span class=\"col-sm-6 pull-right\">
<a href=\"http:/download.com?f={{document.id}}&n={{document.name}}\" class=\"btn btn-xs btn-success\">download</a>
</span>
</p>
</div>
// SNIPPET:
upload
// SNIPPET:
ng-repeat
// SNIPPET:
position: absolute
// SNIPPET:
top
// SNIPPET:
left
// SNIPPET:
pageX
// SNIPPET:
pageY
// SNIPPET:
top
// SNIPPET:
pageY
// SNIPPET:
left
// SNIPPET:
pageX
// SNIPPET:
$('p').on('mouseenter', function(e) {
$(tt).css('top', e.pageY - $(tt).css('height'));
$(tt).css('left', e.pageX);
$(tt).appendTo('body');
}).on('mousemove', function(e) {
$(tt).css('top', e.pageY - $(tt).css('height'));
$(tt).css('left', e.pageX);
}).on('mouseleave', function(e) {
$(tt).detach();
});
// SNIPPET:
$(window).load(function() {
$(\"#input_4_1\").keyup(function() {
$(\"#count_4_1\").text(\"Characters remaining: \" + (2550 - $(this).val().length));
});
});
// SNIPPET:
$(window).load(function() {
$(\"#input_4_1\").keyup(function() {
if (2550 - $(this).val().length >= 501) {
$(\"#count_4_1\").text(\"Characters remaining: \" + (2550 - $(this).val().length));
} else if ((2550 - $(this).val().length <= 500) && (2550 - $(this).val().length >= 101)) {
$(\"#count_4_1\").text(\"<span style=\\\"color: #55a500;\\\">Characters remaining: \" + (2550 - $(this).val().length) + \"</span>\");
} else if (2550 - $(this).val().length <= 100) {
$(\"#count_4_1\").text(\"<span style=\\\"color: #ff0000;\\\">Characters remaining: \" + (2550 - $(this).val().length) + \"</span>\");
}
});
});
// SNIPPET:
<span style=\"color: #55a500;\">Characters remaining: 499</span>
// SNIPPET:
var net = require('net');
var HOST = '127.0.0.1';
var PORT = 1337;
net.createServer(function(sock) {
console.log('CONNECTED: ' + sock.remoteAddress +':'+ sock.remotePort);
sock.on('data', function(data) {
console.log('DATA ' + sock.remoteAddress + ': ' + data);
sock.write('You told me: ' + data);
});
sock.on('close', function(data) {
console.log('CLOSED: ' + sock.remoteAddress +' '+ sock.remotePort);
});
}).listen(PORT, HOST);
console.log('Server listening on ' + HOST +':'+ PORT);
// SNIPPET:
<input type=\"text\" name=\"data\" value=\"\" />
<input type=\"button\" value=\"Send data\" onclick=\"send()\" />
<div id=\"result\"></div>
// SNIPPET:
require
// SNIPPET:
gulp.src
// SNIPPET:
browserify(filename)
// SNIPPET:
var gulp = require(\"gulp\");
var browserify = require(\"browserify\");
var to5browserify = require(\"6to5-browserify\");
var source = require(\"vinyl-source-stream\");
var BUNDLES = [
\"build.js\",
\"export.js\",
\"main.js\"
];
gulp.task(\"bundle\", function () {
/* Old version, using glob:
return gulp.src(\"src/** /*.js\")
.pipe(sixto5())
.pipe(gulp.dest(\"dist\"));
*/
// New version, using array:
return BUNDLES.map(function (bundle) {
return browserify(\"./src/\" + bundle, {debug: true})
.transform(to5browserify)
.bundle()
.pipe(source(bundle))
.pipe(gulp.dest(\"./dist\"));
});
});
gulp.task(\"scripts\", [\"bundle\"]);
gulp.task(\"html\", function () {
return gulp.src(\"src/**/*.html\")
.pipe(gulp.dest(\"dist\"));
});
gulp.task(\"styles\", function () {
return gulp.src(\"src/**/*.css\")
.pipe(gulp.dest(\"dist\"));
});
gulp.task(\"default\", [\"scripts\", \"html\", \"styles\"]);
// SNIPPET:
gulp.src(glob).pipe
// SNIPPET:
gulp.src(glob).map
// SNIPPET:
gulp.src
// SNIPPET:
limelightPlayerCallback()
// SNIPPET:
function limelightPlayerCallback (playerId, eventName, data){
console.log(playerId);
console.log(eventName);
console.log(data);
}
// SNIPPET:
player1
onPlayerLoad
null
// SNIPPET:
LimelightPlayer
// SNIPPET:
LimelightPlayer.doGetPlayheadPositionInMilliseconds()
LimelightPlayer.doLoadMedia()
// SNIPPET:
limelightPlayerCallback()
// SNIPPET:
LimelightPlayer
// SNIPPET:
<div id=\"container_menu\">
<div id=\"menu1\">
<ul id=\"mainmenu\">
<li><a href=\"#\">Choose the first map <i class=\"arrow\"></i></a>
<ul>
<li class=\"div1clear\" data-path=\"tables/cycling1_table.html\"><a href=\"#\">% of employees cycling to work</a></li>
<li class=\"div1clear\" data-path=\"tables/white_british1_table.html\"><a href=\"#\">% of White British residents</a></li>
</ul>
</li>
</ul>
</div>
<div id=\"menu2\">
<ul id=\"mainmenu\">
<li><a href=\"#\">Choose the second map <i class=\"arrow\"></i></a>
<ul>
<li class=\"div2clear\" data-path=\"contents/work/cycling2.html\" data-path2=\"tables/cycling2_table.html\"<><a href=\"#\">% of employees cycling to work</a></li>
<li class=\"div2clear\" data-path=\"contents/ethnic/white_british2.html\" data-path2=\"tables/white_british1_table.html\"><a href=\"#\">% of White British residents</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id=\"container_table\">
<div id=\"table_div1\"></div>
<div id=\"table_div2\"></div>
</div>
// SNIPPET:
<script type=\"text/javascript\">
$(document).ready(function(){
$(\".div1clear\").click(function(){
var tablePath = $(this).data(\"path2\");
$(\"#table_div1\").remove();
$(\"#container_table\").append(\"<div id='table_div1'></div>\");
$('#table_div1').load(tablePath);
});
$(\".div2clear\").click(function(){
var tablePath2 = $(this).data(\"path2\");
$(\"#table_div2\").remove();
$(\"#container_table\").append(\"<div id='table_div2'></div>\");
$('#table_div2').load(tablePath2);
});
});
</script>
// SNIPPET:
<script type=\"text/javascript\">
var table1;
var newList1 = [];
$.each(list, function(index, val) {
table1 = {
name: val.NAME,
value: val.white_brit
};
newList1.push(table1);
});
var createdTable1;
$.each(newList1, function(index, val) {
createdTable1 += '<tr><td>' + val.name + '</td>';
createdTable1 += '<td>' + val.value + '</td></tr>';
});
$('#table_div1').html( createdTable1);
</script>
// SNIPPET:
<script type=\"text/javascript\">
var table2;
var newList2 = [];
$.each(list, function(index, val) {
table2 = {
name: val.NAME,
value: val.cycling
};
newList2.push(table2);
});
var createdTable2;
$.each(newList2, function(index, val) {
createdTable2 += '<tr><td>' + val.name + '</td>';
createdTable2 += '<td>' + val.value + '</td></tr>';
$('#table_div2').html( createdTable2);
</script>
// SNIPPET:
async
// SNIPPET:
parallel
// SNIPPET:
waterfall
// SNIPPET:
this
// SNIPPET:
this
// SNIPPET:
var jobThis = this;
async.waterfall(
[
function(cb) { jobThis.getParseInstalls(cb); },
function(prev, cb) { jobThis.getParseIAPs(prev, cb); },
],
callback
);
// SNIPPET:
async
// SNIPPET:
resizable
// SNIPPET:
.resize('destroy');
// SNIPPET:
$scope.trustUrl = function(domain, id) {
if (domain == 'twitcam') {
var urlInjected = 'http://static.livestream.com/grid/LSPlayer.swf?hash=' + id + '?autoplay=1&amp;autohide=1';
//console.log('url is : ' + urlInjected);
} else if (domain == 'youtube') {
var urlInjected = 'https://www.youtube.com/embed/' + id + '?autoplay=1&amp;autohide=1';
//console.log('url is : ' + urlInjected);
}
var urlFormated = $sce.trustAsResourceUrl(urlInjected);
console.log('urlFormated is : ' + urlFormated);
return $sce.trustAsResourceUrl(urlInjected);
}
// SNIPPET:
<object id=\"twitcamPlayer\" width=\"{{ getWidth(stream_type) }}\" height=\"{{ getHeight(stream_type) }}\" classid=\"{{stream_webcam.webcam_object}}\">
<param name=\"movie\" value=\"{{ trustUrl(stream_webcam.webcam_domain, stream_webcam.webcam_id) }}\"/>
<param name=\"allowScriptAccess\" value=\"always\"/>
<param name=\"allowFullScreen\" value=\"false\"/>
<param name=\"wmode\" value=\"window\"/>
<embed name=\"twitcamPlayer\" src=\"{{ trustUrl(stream_webcam.webcam_domain, stream_webcam.webcam_id) }}\" allowFullScreen=\"false\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" bgcolor=\"#ffffff\" width=\"{{ getWidth(stream_type) }}\" height=\"{{ getHeight(stream_type) }}\" wmode=\"window\" ></embed>
</object>
// SNIPPET:
GET domain-used.com/%7B%7B%20trustUrl(stream_webcam.webcam_domain,%20stream_webcam.webcam_id)%20%7D%7D 404 (Not Found)
// SNIPPET:
var gotFS = function( fileSystem ) {
fileSystem.root.getFile( \"test.pdf\", { create: true, exclusive: false }, gotFileEntry, fail );
};
var gotFileEntry = function( fileEntry ) {
fileEntry.createWriter( gotFileWriter, fail );
};
var gotFileWriter = function( writer ) {
writer.write( pdf );
};
var fail = function( error ) {
console.log( error.code );
};
window.requestFileSystem( LocalFileSystem.PERSISTENT, 0, gotFS, fail );
// SNIPPET:
<div id=\"results\">
<p id=\"resultsExpl\"></p>
<ul>
<li id=\"item1\"></li>
<li id=\"item2\"></li>
<li id=\"item3\"></li>
<li id=\"item4\"></li>
<li id=\"item5\"></li>
</ul>
</div>
<form>
<fieldset>
<label for=\"plBox\" id=\"placeLabel\">
Please tell us!
</label>
<input type=\"text\" id=\"placeBox\" />
</fieldset>
<fieldset>
<button type=\"submit\" id=\"artist\">Submit</button>
</fieldset>
</form>
</article>
<script>
// new array to store entered music artists
var music = [];
// counter variable to track array indexes
var i = 0;
//function to add input to array and then generate list after 5th submission
// clear text box after submit
function processInput() {
document.getElementById(\"placeBox\").value = \"\"
// add entered value to array
places[i] = document.getElementById(\"placeBox\").value;
// write each array element to its corresponding list item
for (i = 0; i < 5; i++) {
listItem = \"item\" + i;
document.getElementById(listItem).innerHTML = places[i];
}
// iterate counter variable
if (i < 5) {
i++;
// add entered value to array and write results to document
} else {
listItem = \"\";
document.getElementById(\"resultsExpl\");
document.write.innerHTML = \"These are your favorite artists:\" + listItem;
}
var submitButton = document.getElementById(\"artist\");
document.addEventListener(\"click\", processInput, false);
if (submitButton.addEventListener) {
submitButton.addEventListener(\"click\", processInput, false);
} else if (submitButton.attachEvent) {
submitButton.attachEvent(\"onclick\", processInput);
}
}
</script>
// SNIPPET:
<ul class = \"classUL\" id = \"idUl1\">
<li>
<label class = \"classLabel\">
<input type = \"checkbox\" class = \"classCheck\" id = \"idchk1\"> Test Test Test
</label>
</li>
<li>
<label class = \"classLabel\">
<input type = \"checkbox\" class = \"classCheck\" id = \"idchk2\" checked= \"true\" > Test Test Test
</label>
</li>
</ul>
<ul class = \"classUL\" id = \"idUl2\">
<li>
<label class = \"classLabel\">
<input type = \"checkbox\" class = \"classCheck\" id = \"idchk1\"> Test Test Test
</label>
</li>
<li>
<label class = \"classLabel\">
<input type = \"checkbox\" class = \"classCheck\" id = \"idchk2\" checked= \"true\" > Test Test Test
</label>
</li>
</ul>
// SNIPPET:
$(document).ready(function () {
$('#submit').click(function () {
var jsonObj = $('#form').serialize();
$.ajax({
type: \"POST\",
url: \"../Home/Index\",
data: JSON.stringify({ \"cus\": jsonObj }),
success: function(data){
alert(data + \"done\");
},
error:function(){
alert(\"Error!!!!\");
}
});
});
});
// SNIPPET:
[HttpPost]
public ActionResult Index(Customer cus)
{
string str = null;
if (cus.Name == \"jude\")
str = \"Success\";
else
str = \"Error!!\";
return Json(str);
}
// SNIPPET:
1 - var model = (Customer)cus.Deserialize();
2 - JavaScriptSerializer js = new JavaScriptSerializer();
var cus1 = js.Deserialize<Customer>(cus);
// SNIPPET:
<form id=\"form\" method=\"post\" action=\"\">
<input type=\"checkbox\" name=\"2kandunder\" class=\"checkbox\" id=\"1\" <?=(isset($_POST['2kandunder'])?' checked':'')?>/> $2000 And Under<br>
<input type=\"checkbox\" name=\"2kto4k\" class=\"checkbox\" id=\"2\" <?=(isset($_POST['2kto4k'])?' checked':'')?>/> $2001 To $4000<br>
</script>
<input type=\"checkbox\" name=\"4kandup\" class=\"checkbox\" <?=(isset($_POST['4kandup'])?' checked':'')?>/> $4001 And Up<br></td>
// SNIPPET:
<script type=\"text/javascript\">
$(function(){
$('.checkbox').on('change',function(){
$('#form').submit();
});
});
// SNIPPET:
<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\"></script>
<script src=\"http://cdn.jsdelivr.net/jquery.cookie/1.4.0/jquery.cookie.min.js\"></script>
<script>
$(\":checkbox\").on(\"change\", function(){
var checkboxValues = {};
$(\":checkbox\").each(function(){
checkboxValues[this.id] = this.checked;
});
$.cookie('checkboxValues', checkboxValues, { expires: 7, path: '/' })
});
function repopulateCheckboxes(){
var checkboxValues = $.cookie('checkboxValues');
if(checkboxValues){
Object.keys(checkboxValues).forEach(function(element) {
var checked = checkboxValues[element];
$(\"#\" + element).prop('checked', checked);
});
}
}
$.cookie.json = true;
repopulateCheckboxes();
</script>
// SNIPPET:
if (isset($_POST[\"2kandunder\"])) {
$arguments[] = \"`2kandunder` = 'yes'\";
}
if (isset($_POST[\"2kto4k\"])) {
$arguments[] = \"`2kto4k` = 'yes'\";
}
if (isset($_POST[\"4kandup\"])) {
$arguments[] = \"4kandup = 'yes'\";
}
if(!empty($arguments)) {
$str = implode(' AND ',$arguments);
$qry = \"SELECT favorite_id, id, venue, imageurl FROM venue_ads WHERE `showingads` = 'yes' AND \" . $str . \"\";
$result = $conn->query($qry);
if ($result->num_rows > 0)
// SNIPPET:
<input type=\"submit\" form=\"email\" value=\"send\">
// SNIPPET:
<!DOCTYPE html>
<!--
Created using JS Bin
http://jsbin.com
Copyright (c) 2015 by anonymous (http://jsbin.com/fivesocaku/1/edit)
Released under the MIT license: http://jsbin.mit-license.org
-->
<meta name=\"robots\" content=\"noindex\">
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<table width=\"80%\" border=\"0\">
<tr>
<th>Qty</th>
<th>1.2m</th>
<th></th>
<th>1.8</th>
<th></th>
</tr>
<tr>
<td><input id=\"qty\" type=\"text\" oninput=\"calculate()\" /></td>
<td><input id=\"R12\" type=\"text\" oninput=\"calculate()\" /></td>
<td><input id=\"b12\" type=\"hidden\" value=\"5\" oninput=\"calculate()\" /></td>
<td><input id=\"R18\" type=\"text\" oninput=\"calculate()\" /></td>
<td><input id=\"B18\" type=\"hidden\" value=\"2\" oninput=\"calculate()\" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<script id=\"jsbin-javascript\">
function calculate() {
var myBox1 = document.getElementById('qty').value;
var myBox2 = document.getElementById('b12').value;
var result = document.getElementById('R12');
var myResult = myBox1 * myBox2;
result.value = myResult;
var myBox4 = document.getElementById('b18').value;
var result18 = document.getElementById('R18');
var myResult18 = myBox1 * myBox4;
result.value = myResult;
}
</script>
</body>
</html>
// SNIPPET:
<div class=\"tableEmulator\">
<ul class=\"trEmulator\">
<li class=\"tdEmulator\">Some text</li>
<li class=\"tdEmulator\">Some text</li>
</ul>
<ul class=\"trEmulator\">
<li class=\"tdEmulator\">Some text</li>
<li class=\"tdEmulator\">Some text</li>
</ul>
</div>
// SNIPPET:
.tableEmulator {
width: auto;
height: auto;
border: 1px solid;
border-color: blue;
}
.trEmulator {
clear:both;
border: 1px solid;
border-color: red;
with:auto;
}
.trEmulator li {
list-style:none;
float:left;
position: relative;
padding: 5px 10px;
border: 1px solid #eee;
}
// SNIPPET:
$(document).ready(function () {
$('td').each(function () {
var $this = $(this);
var $a = $this.find('a');
if ($a) {
$this.css('cursor', 'pointer').click(function () {
$a.click();
});
}
});
});
// SNIPPET:
td {
padding: 20px;
border: 1px solid red;
}
// SNIPPET:
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>
<table>
<tr><td><a href=\"page\">L</a></td>
<td><a href=\"hello\">I</a></td>
<td><a href=\"duckling\">N</a></td>
<td><a href=\"pizza\">K</a></td></tr>
</table>
// SNIPPET:
<form action=\"\" method=\"post\" class=\"usereditform\">
<input type=\"hidden\" name=\"id\" value=\"'.$db_row['id'].'\">
<input type=\"hidden\" name=\"key\" value=\"'.$_SESSION['security_key'].'\">
</form>
// SNIPPET:
$(document).on('click', '.edit_user', function (e) {
e.preventDefault();
var form = $(this).parent().find('form.usereditform');
var post_url = 'db/editform.php';
var post_data = form.serialize();
$.ajax({
type: 'post',
url: post_url,
data:post_data,
success: function () {
$('.edit_user_form_placeholder').load('db/editform.php');
$('.edit_user_popup').fadeIn();
}
});
});
// SNIPPET:
$id = $_POST['id'];
echo $id;
// SNIPPET:
<div class=\"popup edit_user_popup\" style=\"display:none;\">
<div class=\"popup_container\">
<div class=\"edit_user_form_placeholder\"></div>
</div>
</div>
// SNIPPET:
<script>
date = new Date();
document.write('<scr' + 'ipt type=\"text/javascript\" src=\"/js.js?' + date.getTime() + '\"></scr' + 'ipt>')
</script>
// SNIPPET:
<div>
<span id=\"expandAll\" class=\"links\">Expand All</span>
<span id=\"collapseAll\" class=\"links\">Collapse All</span>
</div>
<div id=\"header1\" class=\"header\">
<img src=\"http://cdn1.iconfinder.com/data/icons/fatcow/32/bullet_toggle_minus.png\" />
<span>Sachin Tendulkar</span>
</div>
<div id=\"description1\" class=\"description\">
Sachin Ramesh Tendulkar is an Indian cricketer widely acknowledged as one of the greatest batsmen in One Day International[2] and second only to Don Bradman in the all time greatest list in Test cricket
</div>
<div id=\"header2\" class=\"header\">
<img src=\"http://cdn1.iconfinder.com/data/icons/fatcow/32/bullet_toggle_minus.png\" />
<span>Rahul Dravid</span>
</div>
<div id=\"description2\" class=\"description\">
Rahul Dravid is a former Indian cricketer, who captained the national Test and One Day International (ODI) teams. Born in a Marathi family, he started playing cricket at the age of 12 and later represented the state team at the under-15, under-17 and under-19 levels.
</div>
// SNIPPET:
body{font-family:Arial;}
.header img{position:relative; top:10px;}
.header { font-weight:bold; padding-bottom:10px;cursor:pointer;}
.links {color:#3366CC;cursor:pointer;}
.links:hover {border-bottom:1px solid #3366CC;}
// SNIPPET:
var mImg = \"http://cdn1.iconfinder.com/data/icons/fatcow/32/bullet_toggle_minus.png\";
var pImg = \"http://cdn1.iconfinder.com/data/icons/fatcow/32/bullet_toggle_plus.png\";
$(document).ready(function(){
$(\"#expandAll\").click(function(){
$(\".description\").slideDown();
$(\".header img\").attr(\"src\", mImg)
});
$(\"#collapseAll\").click(function(){
$(\".description\").slideUp();
$(\".header img\").attr(\"src\", pImg)
});
$(\"#header1\").click(function(){
var currentState = $(\"#description1\").css(\"display\");
if(currentState = \"block\"){
$(\"#description1\").slideUp();
$(\"#header1 img\").attr(\"src\", pImg)
}
else{
$(\"#description1\").slideDown();
$(\"#header1 img\").attr(\"src\", mImg)
}
});
$(\"#header2\").click(function(){
var currentState = $(\"#description2\").css(\"display\");
if(currentState = \"block\"){
$(\"#description2\").slideUp();
$(\"#header2 img\").attr(\"src\", pImg)
}
else{
$(\"#description2\").slideDown();
$(\"#header2 img\").attr(\"src\", mImg)
}
});
});
// SNIPPET:
// Track for UserId on Analytics if user is signed in
$scope.$watch('user.userid', function(newVal, oldVal) {
var customUserId = 'notSignedIn';
if (newVal) { customUserId = newVal; };
// Standard Google Universal Analytics code
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-12345678-9', {'userId': customUserId}); // If \"User ID\" feature is available
ga('set', 'dimension1', customUserId); // Set a `customUserId` dimension at page level
ga('send', 'pageview');
});
// SNIPPET:
var temp = 030;
document.writeln(\" temp value after parseInt is =\" + parseInt(temp));
output : temp value after parseInt is =24
// SNIPPET:
var myarray = {bricks:3000, studs:500, shingles:400, tiles:700};
function One() {
alert(myarray.bricks);
}
// SNIPPET:
var myarray = {bricks:3000, studs:500, shingles:400, tiles:700};
var myvalue = \"bricks\"
function Two() {
alert(myarray.myvalue);
}
// SNIPPET:
var size = 400
function createGrid(size) {
$(\"#create\").click(function() {
for (i = 0; i <= size; i++) {
$(\"#container\").append('<div class=\"grid\"> </div>');
}
});
}
$(document).ready(createGrid);
// SNIPPET:
#container {
top: 10px;
position: relative;
width: 960px;
height: 960px;
border-color: black;
margin: auto;
outline: 2px solid black;
}
.grid {
display: inline-block;
border: 1px solid white;
background-color: black;
float: left;
width: 10px;
height: 10px;
}
// SNIPPET:
<!DOCTYPE html>
<html>
<title>
Sam's Etcha Sketch
</title>
<head>
<link type=\"text/css\" rel=\"stylesheet\" href=\"stylesheet.css\">
</head>
<body>
<div>
<button id=\"create\">Create!</button>
</div>
<div id=\"container\"></div>
<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js\"></script>
<script src=\"script.js\"></script>
</body>
</html>
// SNIPPET:
#container
// SNIPPET:
#create
// SNIPPET:
click()
// SNIPPET:
function PostCodeCtrl($scope, Server, $location, $routeParams){
this.postcode = $routeParams.postcode;
if(this.postcode){
this.title = \"dasdasd\";
this.crimes = undefined;
Server.get(\"http://api.postcodes.io/postcodes/\" + this.postcode)
.then(function(response){
this.response = response.data;
if(response.data.status === 200){
Server.get('http://data.police.uk/api/crimes-street/all-crime?lat='+
this.response.result.latitude +
'&lng='+
this.response.result.longitude+
'&date=2013-01').then(function(response){
this.crimes = response.data;
});
}
});
console.log(this.crimes); //returns undefined
setTimeout(function(){
console.log(this.crimes); //returns JSON object
}, 2000);
}else{
$location.path('/');
}
// SNIPPET:
<ul>
<li ng-repeat=\"crime in postcode.crimes\">
{{crime.category}}
</li>
</ul>
// SNIPPET:
(function($) {
$(function(){
$(\"button\").click(function(e) {
$.get(\"/test.json\", function(data, textStatus, jqXHR) {
$(\".list\").each(function() {
$(this).click(function(e) {
setTimeout(function() {
alert(\"Hello World!\");
}, 1000);
});
});
});
});
});
})(jQuery);
// SNIPPET:
<div class=\"fruit\">apple,banana,melon</div>
// SNIPPET:
$('.fruit').each(function(){
var txt = $(this).text();
$(this).html(txt.replace(/,/g,'</li><li>'));
}).wrapInner('<ul><li></li></ul>');
// SNIPPET:
<div class=\"fruit\">
<ul>
<li>apple</li>
<li>banana</li>
<li>melon</li>
</ul>
</div>
// SNIPPET:
<div class=\"fruit\">
<ul>
<li>apple
<li>banana</li>
<li>melon</li>
</li>
</ul>
</div>
// SNIPPET:
greenGoButton.click(function() {
$(\".road-animate\").css(\"-webkit-animation-play-state\", \"running\");
$(\".buildings-animate\").css(\"-webkit-animation-play-state\", \"running\");
road.addClass('road-animate');
buildings.addClass('buildings-animate');
//THIS IS WHAT IS DELAYING
redCar.animate({ left: 1000 }, 5000);
greenCar.animate({ left: 1000 }, 5000);
//END of what I'm asking about :)
infoScreen.toggleClass('screen-two screen-three');
setTimeout(function() {screenTransition(2)} ,1500);
});
// SNIPPET:
redCar.stop().animate({ left: 1000 }, 5000);
greenCar.stop().animate({ left: 1000 }, 5000);
// SNIPPET:
redCar.animate({ left: travelDistance }, { duration: 5000, queue: false });
greenCar.animate({ left: travelDistance }, { duration: 5000, queue: false });
// SNIPPET:
redCar.stop().animate({ left: travelDistance }, { duration: 5000, queue: false });
greenCar.stop().animate({ left: travelDistance }, { duration: 5000, queue: false });
// SNIPPET:
var i = 1;
for(var w in weeks){
var days = weeks[w].getDates();
// days contains normal JavaScript Date objects.
// alert(\"Week starting on \"+days[0]);
var which_week = \"week\"+i;
i++;
for(var d in days){
console.log(days[d].toISOString());
var tr = document.getElementById(which_week);
if(days[d].getMonth()==month){
var newDay = document.createElement(\"div\");
newDay.appendChild(document.createTextNode(days[d].getDate()));
//alert(newDay.data);
newDay.setAttribute(\"id\", newDay.lastChild.data);
$(tr).append('<td><a class=\"linky\" href=\"#\">'+newDay.lastChild.data+'</a></td>');
}
else{
$(tr).append('<td class=\"disabledCell\"><a class=\"linky disabledLink\" href=\"#\">'+days[d].getDate()+'</a></td>');
}
}
}
getEvents();
}
// SNIPPET:
function ajaxEventCallback(event){
var data = event.target.responseText;
data = JSON.parse(event.target.responseText);
for (var i = 0; i < data.length; i++)
//alert(\"event: \" + data[i].title);
//
var dayOfEvent= data[i].day;
document.getElementById(dayOfEvent).appendChild(data[i].title);
}
// SNIPPET:
$(document).ready(checkWidth);
$(window).resize(checkWidth);
function checkWidth() {
var $window = $(window);
$(\"pre\").text($window.width());
if ($window.width() < 321) {
$('.grve-tablet-column-1-4')
.removeClass('grve-tablet-column-1-2').addClass('grve-tablet-column-1');
}
else {
$('.grve-tablet-column-1')
.removeClass('grve-tablet-column-1').addClass('grve-tablet-column-1-2');
}
}
// SNIPPET:
<footer id=\"grve-footer\">
<div class=\"grve-container\">
<div id=\"grve-footer-area\" class=\"grve-section\" data-section-type=\"fullwidth-background\" style=\"visibility: visible; margin-left: 158px; margin-right: 158px;\">
<div class=\"grve-row\">
<div class=\"grve-column-1-4 grve-tablet-column-1-2\"><div id=\"text-3\" class=\"grve-widget widget widget_text\"> <div class=\"textwidget\"><ul class=\"footerlist\">
<li class=\"maintitle\"><a href=\"http://www.sine.co/\">Home</a></li>
<li class=\"title\"><a href=\"http://www.sine.co/features/\">Features</a></li>
<li><a href=\"http://www.sine.co/venue-setup/\">Venue Setup</a></li>
<li><a href=\"http://www.sine.co/visitors-app/\">Visitor's App</a></li>
<li class=\"title\"><a href=\"http://www.sine.co/pricing/\">Pricing</a></li>
<li><a href=\"http://www.sine.co/venue-plan-request/\">Venue Plan Request</a></li>
<li><a href=\"http://www.sine.co/venue-hardware/ \">Venue Hardware</a></li>
</ul></div>
</div></div><div class=\"grve-column-1-4 grve-tablet-column-1-2\"><div id=\"text-2\" class=\"grve-widget widget widget_text\"> <div class=\"textwidget\"><ul class=\"footerlist\">
<li class=\"maintitle\"><a href=\"http://www.sine.co/support/\">Support</a></li>
<li><a href=\"https://sine.freshdesk.com/support/home\"> FAQ</a></li>
<li class=\"secondtitle\"><a href=\"https://admin.sine.co/\">Try Sine for Free<br>Enterprise Login</a></li>
<li><a href=\"http://www.sine.co/privacy/\">Privacy Policy</a></li>
<li><a href=\"http://www.sine.co/terms-of-use/\">Terms of Use</a></li>
</ul></div>
</div></div><div class=\"grve-column-1-4 grve-tablet-column-1-2\"><div id=\"text-4\" class=\"grve-widget widget widget_text\"> <div class=\"textwidget\"><ul class=\"footerlist\">
<li class=\"maintitle\">Free Download</li>
<li><a href=\"https://itunes.apple.com/gb/app/sine/id784906271?mt=8\"><img src=\"http://www.sine.co/wp-content/uploads/2014/11/appstorebutton.png\"></a></li>
<li><a href=\"https://play.google.com/store/apps/details?id=co.sine.sinepass&amp;hl=en\"><img src=\"http://www.sine.co/wp-content/uploads/2014/11/googleplaybutton.png\"></a></li>
</ul></div>
</div></div><div class=\"grve-column-1-4 grve-tablet-column-1-2\"><div id=\"text-5\" class=\"grve-widget widget widget_text\"> <div class=\"textwidget\"><ul class=\"footerlist\">
<li class=\"mail\"><a href=\"mailto:info@sine.co\">info@sine.co</a></li>
<li class=\"skype\"><a href=\"skype:sinehelp?call\">sinehelp</a></li>
<li class=\"phone\"><a href=\"tel:+61881215956\">+61 8 8121 5956</a></li>
<li class=\"twitter\"><a href=\"http://www.twitter.com/SineHQ\">SineHQ</a></li>
<li class=\"linkedin\"><a href=\"http://www.linkedin.com/company/sinepass\">SineHQ</a></li>
</ul></div>
</div></div> </div>
</div>
<div id=\"grve-footer-bar\" class=\"grve-section\" data-section-type=\"fullwidth-element\" data-align-center=\"yes\" style=\"visibility: visible; padding-left: 0px; padding-right: 0px; margin-left: 158px; margin-right: 158px;\">
<div class=\"grve-row\">
<div class=\"grve-column-1-2\">
<div class=\"grve-copyright\">
<p style=\"text-align: center;\">Copyright 2015 Sine Group Pty Ltd. Patents Pending.</p> <a href=\"http://www.bugejastudio.com\" class=\"bugeja\">Website by Bugeja Studio</a>
</div>
</div>
</div>
</div>
</div>
</footer>
// SNIPPET:
$(document).ready(function() {
var $window = $(window);
// Function to handle changes to style classes based on window width
function checkWidth() {
if ($window.width() < 321) {
$('.grve-tablet-column-1-2').removeClass('grve-tablet-column-1-2').addClass('grve-tablet-column-1');
}
}
// Execute on load
checkWidth();
// Bind event listener
$(window).resize(checkWidth);
});
// SNIPPET:
var Abutton = document.createElement(\"div\");
Abutton.className = \"Abutton\";
Abutton.onclick = function () {
new Messi(
'Are you sure you want to close your job?',
{
title: 'Are you sure?',
buttons: [
{id: 0, label: 'Yes', val:'Y' , class: 'deleteJob'},
{id: 1, label: 'No', val: 'N', class: 'cancelAction'}
]
}
);
};
Abutton.title = \"Closed?\";
Abutton.appendChild(document.createTextNode(\"Close Job\"));
li.appendChild(Abutton);
// SNIPPET:
$(\".deleteJob\").click(function(){
deleteJob();
console.log(\"heelo\");
});
// SNIPPET:
[ w ] [ - ] [ - ] [ - ]
[ - ] [ O ] [ - ] [ - ]
[ - ] [ - ] [ R ] [ - ]
[ - ] [ - ] [ - ] [ D ]
// SNIPPET:
function printWord() {
var word = document.getElementById('word').value;
var body=document.getElementsByTagName('body')[0];
var tbl=document.createElement('table');
tbl.style.width='80%';
tbl.setAttribute('border','1');
var tbdy=document.createElement('tbody');
for(var i=0;i<3;i++){
var tr=document.createElement('tr');
for(var j=0;j<2;j++){
if(i==2 && j==1){
break
} else {
var td=document.createElement('td');
td.appendChild(document.createTextNode('\\u0020'))
i==1&&j==1?td.setAttribute('rowSpan','2'):null;
tr.appendChild(td)
}
}
tbdy.appendChild(tr);
}
tbl.appendChild(tbdy);
body.appendChild(tbl)
for (var i = 0; i < word.length; i++) {
console.log(word.charAt(i));
}
}
// SNIPPET:
<html>
<head>
<title>Help requested - Forming a table from word</title>
</head>
<body>
<div id=\"table\">
<table>
<tr>
<td><b>Type a word:</b></td>
<td>
<input type=\"text\" id=\"word\">
</td>
</tr>
<tr>
<td id=\"btn\" colspan=\"2\">
<button type=\"button\" onclick=\"printWord();\">Submit</button>
</td>
</tr>
</table>
</div>
</body>
</html>
// SNIPPET:
UIOutput js = new UIOutput();
js.setRendererType(\"javax.faces.resource.Script\");
js.getAttributes().put(\"library\", \"js\");
js.setValue(\"alert(123);\");
FacesContext context = FacesContext.getCurrentInstance();
context.getViewRoot().addComponentResource(context, js, \"body\");
// SNIPPET:
npm install grunt-svg-sprite --save-dev
// SNIPPET:
grunt.loadNpmTasks('grunt-svg-sprite');
// SNIPPET:
svg_sprite : {
basic : {
// Target basics
expand : true,
cwd : 'images/svg-logo/',
src : 'images/svg-logo/*.svg',
dest : 'out/',
// Target options
options : {
mode : {
css : { // Activate the «css» mode
render : {
css : true // Activate CSS output (with default options)
}
}
}
}
}
},
// SNIPPET:
Project_folder
├───css
├───Images
│ └───svg-logo
├───GruntFile.js
├───html
├───node_modules
├───include
├───package.json
// SNIPPET:
for(var j=0; j<currentQuestion.choices.length; j++){
var choiceText = currentQuestion.choices[j];
var newRadioButton = document.createElement(\"input\");
newRadioButton.name=\"optionsList\";
newRadioButton.type=\"radio\";
newRadioButton.value = choiceText;
newRadioButton.innerHTML = choiceText;
label.appendChild(newRadioButton);
}
// SNIPPET:
var radioButtonsGroup = document.label1.optionsList;
// SNIPPET:
var radioButtonsGroup = document.getElementsByName(\"optionsList\");
// SNIPPET:
var radioButtonsGroup = document.getElementsByTagName(\"inputs\");
// SNIPPET:
var canvas1 = document.createElement('canvas');
canvas1.id = \"canvas1\";
canvas1.width = w+50;
canvas1.height = h+50;
document.getElementById('pngcon').appendChild(canvas1);
var html = new XMLSerializer().serializeToString(document.getElementById(chartId).querySelector('svg'));
var imgsrc = 'data:image/svg+xml;base64,'+ btoa(html);
var canvas = document.getElementById(\"canvas1\");
var context = canvas.getContext(\"2d\");
var canvasdata;
var image = new Image;
image.src = imgsrc;
image.onload = function() {
context.drawImage(image, 0, 0);
canvasdata = canvas.toDataURL(\"image/png\");
var a = document.createElement(\"a\");
a.id=\"imagepng\"
a.download = chartname+\".png\";
a.href = canvasdata;
document.body.appendChild(a);
document.getElementById(\"imagepng\").click();
// SNIPPET:
<div ng-hide=\"section1\">
<select>
<option>Select List 1</option>
<option>Select List 2</option>
</select>
</div>
<div ng-hide=\"section1\">
<ul>
<li ng-repeat=\"name in names\">{{name.item}}</li>
</ul>
<button type=\"button\" ng-click=\"section1=!section1\">Edit</button>
</div>
// SNIPPET:
<div ng-show=\"section1\">
<button type=\"button\" ng-click=\"section2=!section2\">+ Create New Item</button>
</div>
<div ng-show=\"section1\">
<ul>
<li ng-repeat=\"name in names\">
<input type=\"text\" ng-model=\"name.item\">
</li>
</ul>
<button type=\"button\" ng-click=\"section1=!section1\">Save</button>
</div>
// SNIPPET:
<div ng-show=\"section2\">
<ul>
<li ng-repeat=\"name in names\">
<input type=\"text\">
</li>
</ul>
<button type=\"button\" ng-click=\"section2=!section2\">Save New List</button>
</div>
// SNIPPET:
app.factory('SomeFactory',['$resource', function($resource){
//access_token only needs to be set once
var access_token = 0;
var request = $resource('/my/server/').get();
request.promise.then(function(result){
access_token = result;
}
);
return $resource('https://third.party/:token',{token: access_token});
}])
// SNIPPET:
function createBall(tempPosSize)
{
geometry = new THREE.SphereGeometry(tempPosSize,16,16),
new THREE.MeshLambertMaterial({color: 0xff0000,reflectivity: 0.0});
ball = new THREE.Mesh( geometry, material );
ballArray[i] = ball;
}
// SNIPPET:
[I]
// SNIPPET:
ballArray[i] = {Name : foobar, BallData: ball}
// SNIPPET:
PhantomJS 1.9.8 (Mac OS X): Executed 2 of 2 SUCCESS (0.003 secs / 0.021 secs)
DEBUG [karma]: Run complete, exiting.
DEBUG [launcher]: Disconnecting all browsers
DEBUG [proxy]: failed to proxy /app/view/SearchForm.js?_dc=1428867938629 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/view/Main.js?_dc=1428867938628 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/view/ImageDetailView.js?_dc=1428867938629 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/view/ItemDetailView.js?_dc=1428867938629 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/controller/News.js?_dc=1428867938630 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/controller/Home.js?_dc=1428867938630 (browser hung up the socket)
DEBUG [coverage]: Writing coverage to /appdir/coverage/PhantomJS 1.9.8 (Mac OS X)
// SNIPPET:
// SNIPPET:
// SNIPPET:
-|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
File | % Stmts |% Branches | % Funcs | % Lines |
// SNIPPET:
// SNIPPET:
// SNIPPET:
-|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
-|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
All files | 100 | 100 | 100 | 100 |
// SNIPPET:
// SNIPPET:
// SNIPPET:
-|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
// SNIPPET:
// SNIPPET:
// SNIPPET:
--|
DEBUG [launcher]: Process PhantomJS exited with code 0
DEBUG [temp-dir]: Cleaning temp dir
Done, without errors.
// SNIPPET:
module.exports = function (config) {
config.set({
basePath: '',
frameworks: [ 'jasmine' ],
files: [
'touch/sencha-touch-all.js',
'setup.js',
'app.js',
{
pattern: 'app/**/*.js',
watched: true,
included: false,
served: true
},
'tests/**/*.js'
],
proxies: {
'/': 'http://localhost:9000/'
},
preprocessors: {
'app/**/*.js': ['coverage']
},
reporters: ['junit', 'progress', 'coverage'],
coverageReporter: {
type: 'text'
},
port: 9876,
colors: true,
logLevel: config.LOG_DEBUG,
autoWatch: true,
browsers: [ 'PhantomJS' ],
captureTimeout: 60000,
singleRun: false
});
};
// SNIPPET:
DEBUG [proxy]: failed to proxy /app/model/Image.js?_dc=1428868670561 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/model/Image.js?_dc=1428868670561 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/model/Image.js?_dc=1428868670561 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/model/Image.js?_dc=1428868670561 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/model/Image.js?_dc=1428868670561 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/model/Image.js?_dc=1428868670561 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/model/Image.js?_dc=1428868670561 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/model/Image.js?_dc=1428868670561 (browser hung up the socket)
DEBUG [proxy]: failed to proxy /app/model/Image.js?_dc=1428868670561 (browser hung up the socket)
// SNIPPET:
jQuery(function() {
jQuery(\"div.inputQty\").append('<div class=\"inc add\">&#43;</div><div class=\"dec add\">&#8722;</div>');
jQuery(\".add\").click(function() {
var jQueryadd = jQuery(this);
var oldValue = jQueryadd.parent().find(\"input\").val();
var newVal = 0;
if (jQueryadd.text() == \"›\") {
newVal = parseFloat(oldValue) + 1;
// AJAX save would go here
} else {
// Don't allow decrementing below zero
if (oldValue > 1) {
newVal = parseFloat(oldValue) - 1;
// AJAX save would go here
}
if(oldValue == 1){
newVal = parseFloat(oldValue);
}
}
jQueryadd.parent().find(\"input\").val(newVal);
});
});
// SNIPPET:
<div class=\"inputQty\">
<span class=\"up\">&#43;</span>
<input type=\"text\" maxlength=\"6\" name=\"oa_quantity\" class=\"input-quantity\" value=\"1\"/>
<span class=\"down\">&#8722;</span>
</div>
// SNIPPET:
/** @jsx React.DOM */
var React = require('react');
var MyMixin = require('./myMixin').MyMixin;
var Test = React.createClass({
mixins: [MyMixin.wantsToKnowTheTestId(this.props.id)],
propTypes: {
id: React.PropTypes.string.isRequired
},
render: function() {
return (<h1>My id is: {this.props.id}</h1>);
}
});
module.exports = {Test: Test};
// SNIPPET:
Uncaught TypeError: Cannot read property 'id' of undefined
// SNIPPET:
this.props
// SNIPPET:
timeouts[\"mr\"+mI] = setTimeout(function(){
groups[\"mr\"+mI].expired = 1;
io.sockets.emit(\"invite_channel\",'{\"type\":\"pullback\",\"mI\":\"mr'+mI+'\"}');
},120000);
// SNIPPET:
mI
// SNIPPET:
setTimeout
// SNIPPET:
mI
// SNIPPET:
timeouts[\"mr\"+mI]
// SNIPPET:
timeouts[]
// SNIPPET:
mI
// SNIPPET:
bind()
// SNIPPET:
closed method
// SNIPPET:
new Request.HTML
// SNIPPET:
ReferenceError: Request is not defined
// SNIPPET:
<button id=\"start\">start</button>
/*
new Request.HTML({
url: '/echo/html/',
data: {
html: \"returned data\",
delay: 3
},
method: 'get',
update: 'target'
}).send();
*/
$('#start').click(function () {
$.get(\"/echo/html/\", function (data) {
alert(data);
});
})
// SNIPPET:
jQuery('img').each(function() {
jQuery(this).attr('title', jQuery(this).attr('alt'));
})
// SNIPPET:
<td>
// SNIPPET:
<td onmouseover=\"tokenColor(this)\" onmouseout=\"noToken(this)\" onclick=\"dropToken(this, 1)\"></td>
// SNIPPET:
dropToken()
// SNIPPET:
<td>
// SNIPPET:
background-color
// SNIPPET:
playerTurn
// SNIPPET:
dropToken()
// SNIPPET:
function dropToken(obj, column)
{
$('table tr:last-child td:nth-child(column)').css(\"background-color\", playerTurn);
if (playerTurn == \"Red\")
{
playerTurn = \"Blue\"
obj.style.backgroundColor = \"Blue\";
}
else
{
playerTurn = \"Red\"
obj.style.backgroundColor = \"Red\";
}
}
// SNIPPET:
<script>
var playerTurn = \"Red\"
var column = 0;
function tokenColor (obj)
{
if (playerTurn == \"Red\")
{
obj.style.background = \"Red\";
obj.style.border = \"2px solid black\";
}
else
{
obj.style.backgroundColor = \"Blue\";
obj.style.border = \"2px solid black\";
}
}
function noToken(obj)
{
obj.style.backgroundColor = \"white\";
obj.style.border = \"2px solid white\";
}
function dropToken(obj, column)
{
$('table tr:last-child td:nth-child(' + column + ')').css(\"background-color\", playerTurn);
if (playerTurn == \"Red\")
{
playerTurn = \"Blue\"
obj.style.backgroundColor = \"Blue\";
}
else
{
playerTurn = \"Red\"
obj.style.backgroundColor = \"Red\";
}
}
function resetBoard()
{
location.reload()
}
</script>
<h1>Connect Four</h1>
<table>
<tr class=\"topRow\">
<td onmouseover=\"tokenColor(this)\" onmouseout=\"noToken(this)\" onclick=\"dropToken(this, 1)\"></td>
<td onmouseover=\"tokenColor(this)\" onmouseout=\"noToken(this)\" onclick=\"dropToken(this, 2)\"></td>
<td onmouseover=\"tokenColor(this)\" onmouseout=\"noToken(this)\" onclick=\"dropToken(this, 3)\"></td>
<td onmouseover=\"tokenColor(this)\" onmouseout=\"noToken(this)\" onclick=\"dropToken(this, 4)\"></td>
<td onmouseover=\"tokenColor(this)\" onmouseout=\"noToken(this)\" onclick=\"dropToken(this, 5)\"</td>
<td onmouseover=\"tokenColor(this)\" onmouseout=\"noToken(this)\" onclick=\"dropToken(this, 6)\"></td>
<td onmouseover=\"tokenColor(this)\" onmouseout=\"noToken(this)\" onclick=\"dropToken(this, 7)\"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<button type=\"button\" onclick=\"resetBoard()\">Empty Tokens</button>
</body>
// SNIPPET:
<table id=\"my-table\" ng-table=\"tableParams\" class=\"table\" show-filter=\"true\">
// SNIPPET:
<button type=\"button\" ng-click=\"toggleSearch()\">Toggle search</button>
// SNIPPET:
<script src=\"./edit_files/prototype.js\" type=\"text/javascript\"></script>
<script src=\"./edit_files/application.js\" type=\"text/javascript\"></script>
<div class=\"contact\">
<table border=\"0\">
<tr>
<td><select class=\"position_id\" id=\"obj_client_contact_attributes__position_id\" name=\"obj_client[contact_attributes][][position_id]\"><option value=\"1\" selected=\"selected\">INTELIGENT</option><option value=\"2\">OTHER</option></select></td>
<td><input class=\"should_change_value\" id=\"obj_client_contact_attributes__phone_mail\" name=\"obj_client[contact_attributes][][phone_mail]\" type=\"text\" value=\"cristianoronaldo@realmadrid.com\"/></td>
<td>
<a href=\"#\" onclick=\"mark_for_destroy_contact(this,true); return false;\">DELETE</a>
<input id=\"obj_client_contact_attributes__id\" name=\"obj_client[contact_attributes][][id]\" type=\"hidden\" value=\"16594\"/>
<input class=\"should_destroy\" id=\"obj_client_contact_attributes__should_destroy\" name=\"obj_client[contact_attributes][][should_destroy]\" type=\"hidden\"/>
</td>
</tr>
</table>
</div>
<div class=\"contact\">
<table border=\"0\">
<tr>
<td><select class=\"position_id\" id=\"obj_client_contact_attributes__position_id\" name=\"obj_client[contact_attributes][][position_id]\"><option value=\"1\" selected=\"selected\">INTELIGENT</option><option value=\"2\">OTHER</option></select></td>
<td><input class=\"should_change_value\" id=\"obj_client_contact_attributes__phone_mail\" name=\"obj_client[contact_attributes][][phone_mail]\" type=\"text\" value=\"ONLY THE INPUT WILL BE test@hotmail.com IF I CLICK ON DELETE\"/></td>
<td>
<a href=\"#\" onclick=\"mark_for_destroy_contact(this,true); return false;\">DELETE</a>
<input id=\"obj_client_contact_attributes__id\" name=\"obj_client[contact_attributes][][id]\" type=\"hidden\" value=\"16594\"/>
<input class=\"should_destroy\" id=\"obj_client_contact_attributes__should_destroy\" name=\"obj_client[contact_attributes][][should_destroy]\" type=\"hidden\"/>
</td>
</tr>
</table>
</div>
// SNIPPET:
function mark_for_destroy_contact(element,should_destroy,should_change_value) {
var element_text = $(element).up('.contact').down('.position_id',0);
element_text.className = 'position_id';
element_text.value = '';
if (should_destroy) {
$(element).next('.should_destroy').value = 1;
}
$(element).up('.contact').hide();
}
// SNIPPET:
function mark_for_destroy_contact(element,should_destroy,should_change_value) {
var element_text = $(element).up('.contact').down('.position_id',0);
element_text.className = 'position_id';
element_text.value = '';
$('should_change_value').update(\"test@hotmail.com\");
if (should_destroy) {
$(element).next('.should_destroy').value = 1;
}
$(element).up('.contact').hide();
}
// SNIPPET:
var daysFromBeginDate = parseInt($(\"#policyDuration\").val()) * 7
alert(daysFromBeginDate)
var beginDate = new Date(\"2015-04-24\");
alert(beginDate)
var endDate = new Date(\"2015-05-08\");
alert(beginDate.getDate() + daysFromBeginDate)
endDate.setDate(new Date(beginDate.getDate() + daysFromBeginDate));
alert(endDate.toString())
// SNIPPET:
Sun May 31 2015 17:00:000 GMT
// SNIPPET:
position
// SNIPPET:
fire
// SNIPPET:
Bot.prototype.fire = function () {
this.bombs.push(new Bomb(this.position));
};
// SNIPPET:
this.position
// SNIPPET:
this.position = position
// SNIPPET:
position
// SNIPPET:
this.position = {
x: position.x,
y: position.y,
angle: position.angle
};
// SNIPPET:
$.ajax({
type:'post'
data:{data:hello},
url: '' //here I don't know how to point to node.js client
success:function(data){
}
});
// SNIPPET:
var net = require('net');
var clients = [];
var server = net.createServer(function (socket) {
clients.push(socket);
});
server.listen(1337,'localhost',function(){
console.log(\"server is listening in port 1337\");
});
// SNIPPET:
var net = require('net');
var client = new net.Socket();
client.connect(1337, '127.0.0.1', function() {
console.log('Connected');
client.write('Hello, server!);
});
client.on('data', function(data) {
console.log('Received: ' + data);
client.destroy();
});
client.on('close', function() {
console.log('Connection closed');
});
// SNIPPET:
angular.module('donate', ['angularPayments'])
function DonateCtrl($scope, $http) {
$scope.handleStripe = function(status, response){
console.log('response', status, response);
if(response.error) {
console.log('error');
// there was an error. Fix it.
} else {
// got stripe token, now charge it or smt
console.log('no error');
var token = response.id;
console.log(token);
return $http.post('http://localhost:8181/api/payments', response)
}
}
};
// SNIPPET:
<form stripe-form=\"handleStripe\" name=\"donateForm\">
<h3>Credit Card Details</h3>
<label for=\"\">Card number</label>
<input type=\"text\" name=\"number\" ng-model=\"number\" payments-validate=\"card\" payments-format=\"card\" payments-type-model=\"type\" ng-class=\"donateForm.number.$card.type\" placeholder=\"4500 0000 0000 0000\" />
<label for=\"\">Expiry</label>
<input type=\"text\" ng-model=\"expiry\" payments-validate=\"expiry\" payments-format=\"expiry\" placeholder=\"01 / 99\" />
<label for=\"\">CVC</label>
<input type=\"text\" ng-model=\"cvc\" payments-validate=\"cvc\" payments-format=\"cvc\" payments-type-model=\"type\" placeholder=\"123\" />
<h3>Donor Details</h3>
<label for=\"name\">Name on card </label>
<input type=\"text\" name=\"name\" ng-model=\"name\" placeholder=\"John Smith\">
<label for=\"address\">Street Address</label>
<input type=\"text\" name=\"address\" ng-model=\"addressLine1\" placeholder=\"123 Any Street\" required/>
<input type=\"text\" name=\"city\" ng-model=\"addressCity\" placeholder=\"Anytown\" required />
<input type=\"text\" name=\"province\" ng-model=\"addressState\" placeholder=\"Any Province\" ng-required=\"addressCountry == 'Canada' || addressCountry == 'United States'\" />
<select data-placeholder=\"Choose a Country\" name=\"country\" ng-model=\"addressCountry\" required>
{% include 'includes/countryselect' %}
</select>
<input type=\"text\" name=\"postcode\" ng-model=\"addressZip\" placeholder=\"A1B 2C3\" ng-required=\"addressCountry == 'Canada' || addressCountry == 'United States'\" />
<div ng-show=\"donateForm.addressLine1.$pristine && donateForm.addressLine1.$invalid || donateForm.addressCity.$pristine && donateForm.addressCity.$invalid || donateForm.addressState.$pristine && donateForm.addressState.$invalid || addressCountry.$pristine && addressCountry.$invalid || donateForm.addressZip.$pristine && donateForm.addressZip.$invalid\" class=\"help-block\">Enter your full home address.</div>
<label for=\"phone\">Phone Number <small>(include country &amp; area code)</small></label>
<input type=\"tel\" name=\"phone\" ng-model=\"phone\" placeholder=\"+1 204-555-5555\" required />
<div ng-show=\"donateForm.phone.$invalid && donateForm.phone.$pristine\" class=\"help-block\">Enter your phone number.</div>
<label for=\"email\">Email Address</label>
<input type=\"email\" name=\"email\" ng-model=\"email\" placeholder=\"johnsmith@email.com\" required />
<div ng-show=\"donateForm.email.$invalid && donateForm.email.$pristine\" class=\"help-block\">Enter your email address.</div>
<button type=\"submit\">Submit</button>
// SNIPPET:
<td><input id=\"date\" name=\"date\" /></td>
// SNIPPET:
//Percent change Calculation
var pChange = function(){
var a = document.getElementById(\"number1\").value;
var b = document.getElementById(\"number2\").value;
var c = b-a;
var fOutPut = c / a;
fOutput=fOutPut*100;
var finalOut=fOutput.toFixed(2);
$('#answerText').append(\"<p><strong>\" + \"The percentage change is \"+finalOut+ \"%\" + \"</strong></p>\");
};
//ClearPage Function
var Clear = function(){
$('#answer').html(\"\");
};
//Submit via enter key press instead of button event.
$(\"#number2\").keyup(function(event){
if(event.keyCode == 13){
$(\"#Calc\").click();
}
});
// SNIPPET:
<html>
<head>
<script src=\"jquery-2.1.3.min.js\"></script>
<script src=\"materialize/js/materialize.min.js\"></script>
<script src=\"slidebars.min.js\"></script>
<link type=\"text/css\" rel=\"stylesheet\" href=\"materialize/css/materialize.css\" media=\"screen,projection\"/>
<title>Percent Change Calculator</title>
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\">
<!-- Slidebars CSS -->
<link rel=\"stylesheet\" href=\"slidebars.css\">
<link rel=\"stylesheet\" href=\"Percent.css\"
</head>
<body>
<!--Main content-->
<div id=\"sb-site\">
<div class=\"navbar-fixed\">
<nav>
<a href=\"#\" data-activates=\"mobile-demo\" class=\"button-collapse\"><i class=\"mdi-navigation-menu\"></i></a>
<div class=\"nav-wrapper\">
<div class=\"sb-toggle-left\">
<a href=\"#\" class=\"brand-logo\"><img class=\"navicon\" src=\"navicon-round.svg\"></img></a>
</div>
<a href=\"#\" class=\"brand-logo center\">Percent Change Calculator</a>
<ul id=\"nav-mobile\" class=\"right hide-on-med-and-down\">
<li><a class=\"dropdown-button\" href=\"#\" data-activates=\"dropdown1\">Math Tools<i class=\"mdi-navigation-arrow-drop-down right\"></i></a></li>
</ul>
</div>
</nav>
</div>
<ul id=\"dropdown1\" class=\"dropdown-content\">
<li><a href=\"#\">Percent Change</a></li>
<li class=\"divider\"></li>
<li><a href=\"trianglecalculator.html\">Triangle Calculator</a></li>
</ul>
<!--Alternate Menu Toggle-->
<!--<div id=\"ButtonContainer\">
<div class=\"sb-toggle-left\">
<div class=\"navicon-line\"></div>
<div class=\"navicon-line\"></div>
<div class=\"navicon-line\"></div>
</div>-->
<div id=\"input-fields\">
<div class=\"row\">
<div class=\"input-field col s3\">
<input value=\"Number #1\" id=\"number1\" type=\"number\" class=\"validate\">
<label class=\"active\" for=\"number1\">Number #1</label>
</div>
</div>
<div class=\"row\">
<div class='input-field col s3'>
<input value=\"Number #1\" id=\"number2\" type=\"number\" class=\"validate\">
<label class=\"active\" for=\"number2\">Number #2</label>
</div>
</div>
<div id='answer'>
<div id='answerText'></div></div>
<table>
<tr>
<td>
<button id = \"Calc\" type = 'button' onclick = \"pChange();\">Click to Calculate Percent Change</button>
</td>
<td>
<button id = \"Clear\" type = 'button' onclick = \"Clear();\">Click to clear screen</button>
</td>
</tr>
</table>
</div>
</div>
<div class=\"sb-slidebar sb-left sb-width-custom\" data-sb-width=\"140\">
<!-- Your left Slidebar content. -->
<ul id=\"dropdown2\" class=\"dropdown-content\">
<li><a href=\"#\">About Me</a></li>
<li class=\"divider\"></li>
<li><a href=\"#\">About This Site</a></li>
</ul>
<ul id=\"homedropdown\" class=\"dropdown-content\">
</li>
<li><a href=\"#!\">two</a></li>
<li><a href=\"#!\">three</a></li>
</ul>
<a class=\"btn dropdown-button\" href=\"#!\" data-activates=\"dropdown2\">About<i class=\"mdi-navigation-arrow-drop-down right\"></i></a>
<a class=\"btn dropdown-button\" href=\"#!\" data-activates=\"homedropdown\">Tools<i class=\"mdi-navigation-arrow-drop-down right\"></i></a>
<div class=\"sb-slidebar sb-right\">
</div>
</body>
</html>
// SNIPPET:
$state.go();
// SNIPPET:
$rootScope.$on('$stateChangeStart', function (event) {
$state.go();
event.preventDefault()
})
// SNIPPET:
DiaryDashboard.controller('AppController',
['$scope', '$rootScope', '$localStorage', '$http', '$state'
, function ($scope, $rootScope, $localStorage, $http, $state) {
$rootScope.$on('$stateChangeStart', function (event, toState) {
if ($localStorage.userdetails &&
$localStorage.userdetails.isAuthenticated == true) {
//Check for Authentication state
//If not redirect to the state in the else clause
//Populate the $rootScope with user details
$rootScope.userdetails = $localStorage.userdetails;
//Switch to the parent state
$state.go();
event.preventDefault();
} else {
//If User not authenticated
//GO to the Authentication State
$state.go('auth');
event.preventDefault();
}
})
}]);
// SNIPPET:
<form action=\"demo_form.asp\">
<input type=\"file\" name=\"randomfile\" id=\"rand\">
<br/>
<input type=\"submit\" value=\"Submit\">
</form>
<script type=\"text/javascript\" src=\"fileEditor.js\">
</script>
// SNIPPET:
$(document).ready(function() {
var img = $('img');
console.log(img.length); //returns 0 WHY?
});
// SNIPPET:
img
// SNIPPET:
var use = document.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");
use.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"mydefs.svg#hello\");
var title = document.createElementNS('http://www.w3.org/2000/svg', 'title');
title.textContent = data[i].status;//JSON Object
svg.appendChild(rect);
svg.appendChild(text);
//Use and Title added
svg.appendChild(use);
svg.appendChild(title);
document.body.appendChild(svg);
// SNIPPET:
var colours = [\"red\", \"orange\", \"green\", \"blue\"];
var red = [\"item1\", \"item2\", \"item3\", \"item4\"];
var orange = [\"item5\", \"item6\"];
var green = [\"item7\", \"item8\", \"item9\", \"item10\", \"item11\"];
var blue = [\"item12\"];
//generate coloured boxes
for (var i = 0; i < colours.length; i++) {
var colour = colours[i];
$(\"<div class='box \" + colour + \"' id='\" + colour + \"'>\").appendTo('#boxes');
//generate items in boxes
for (var j = 0; j < colours[i].length; j++) {
$(\"<div id='\" + red[j] + \"'>\" + red[j] + \"</div>\").appendTo(\"#\" + colours[i]);
}
$(\"</div>\").appendTo('#boxes');
}
// SNIPPET:
.nav {
margin-bottom: 20px;
margin-left: 0;
list-style: none;
text-align: center;
}
.nav > li > a {
display: block;
}
.nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: #eeeeee;
}
.nav > li > a > img {
max-width: none;
}
.nav > .pull-right {
float: right;
}
.nav-header {
display: block;
padding: 3px 15px;
font-size: 11px;
font-weight: bold;
line-height: 20px;
color: #999999;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
text-transform: uppercase;
}
.nav li + .nav-header {
margin-top: 9px;
}
.nav-list {
padding-right: 15px;
padding-left: 15px;
margin-bottom: 0;
}
.nav-list > li > a,
.nav-list .nav-header {
margin-right: -15px;
margin-left: -15px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.nav-list > li > a {
padding: 3px 15px;
}
.nav-list > .active > a,
.nav-list > .active > a:hover,
.nav-list > .active > a:focus {
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
background-color: #0088cc;
}
.nav-list [class^=\"icon-\"],
.nav-list [class*=\" icon-\"] {
margin-right: 2px;
}
.nav-list .divider {
*width: 100%;
height: 1px;
margin: 9px 1px;
*margin: -5px 0 5px;
overflow: hidden;
background-color: #e5e5e5;
border-bottom: 1px solid #ffffff;
}
.nav-tabs,
.nav-pills {
*zoom: 1;
}
.nav-tabs:before,
.nav-pills:before,
.nav-tabs:after,
.nav-pills:after {
display: table;
line-height: 0;
content: \"\";
}
.nav-tabs:after,
.nav-pills:after {
clear: both;
}
.nav-tabs > li,
.nav-pills > li {
float: left;
}
.nav-tabs > li > a,
.nav-pills > li > a {
padding-right: 12px;
padding-left: 12px;
margin-right: 2px;
line-height: 14px;
}
.nav-tabs {
border-bottom: 1px solid #ddd;
}
.nav-tabs > li {
margin-bottom: -1px;
}
.nav-tabs > li > a {
padding-top: 8px;
padding-bottom: 8px;
line-height: 20px;
border: 1px solid transparent;
-webkit-border-radius: 4px 4px 0 0;
-moz-border-radius: 4px 4px 0 0;
border-radius: 4px 4px 0 0;
}
.nav-tabs > li > a:hover,
.nav-tabs > li > a:focus {
border-color: #eeeeee #eeeeee #dddddd;
}
.nav-tabs > .active > a,
.nav-tabs > .active > a:hover,
.nav-tabs > .active > a:focus {
color: #555555;
cursor: default;
background-color: #ffffff;
border: 1px solid #ddd;
border-bottom-color: transparent;
}
.nav-pills > li > a {
padding-top: 8px;
padding-bottom: 8px;
margin-top: 2px;
margin-bottom: 2px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.nav-pills > .active > a,
.nav-pills > .active > a:hover,
.nav-pills > .active > a:focus {
color: #ffffff;
background-color: #0088cc;
}
.nav-stacked > li {
float: none;
}
.nav-stacked > li > a {
margin-right: 0;
}
.nav-tabs.nav-stacked {
border-bottom: 0;
}
.nav-tabs.nav-stacked > li > a {
border: 1px solid #ddd;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.nav-tabs.nav-stacked > li:first-child > a {
-webkit-border-top-right-radius: 4px;
border-top-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
border-top-left-radius: 4px;
-moz-border-radius-topright: 4px;
-moz-border-radius-topleft: 4px;
}
.nav-tabs.nav-stacked > li:last-child > a {
-webkit-border-bottom-right-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
border-bottom-left-radius: 4px;
-moz-border-radius-bottomright: 4px;
-moz-border-radius-bottomleft: 4px;
}
.nav-tabs.nav-stacked > li > a:hover,
.nav-tabs.nav-stacked > li > a:focus {
z-index: 2;
border-color: #ddd;
}
.nav-pills.nav-stacked > li > a {
margin-bottom: 3px;
}
.nav-pills.nav-stacked > li:last-child > a {
margin-bottom: 1px;
}
.nav-tabs .dropdown-menu {
-webkit-border-radius: 0 0 6px 6px;
-moz-border-radius: 0 0 6px 6px;
border-radius: 0 0 6px 6px;
}
.nav-pills .dropdown-menu {
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
.nav .dropdown-toggle .caret {
margin-top: 6px;
border-top-color: #0088cc;
border-bottom-color: #0088cc;
}
.nav .dropdown-toggle:hover .caret,
.nav .dropdown-toggle:focus .caret {
border-top-color: #005580;
border-bottom-color: #005580;
}
/* move down carets for tabs */
.nav-tabs .dropdown-toggle .caret {
margin-top: 8px;
}
.nav .active .dropdown-toggle .caret {
border-top-color: #fff;
border-bottom-color: #fff;
}
.nav-tabs .active .dropdown-toggle .caret {
border-top-color: #555555;
border-bottom-color: #555555;
}
.nav > .dropdown.active > a:hover,
.nav > .dropdown.active > a:focus {
cursor: pointer;
}
.nav-tabs .open .dropdown-toggle,
.nav-pills .open .dropdown-toggle,
.nav > li.dropdown.open.active > a:hover,
.nav > li.dropdown.open.active > a:focus {
color: #ffffff;
background-color: #999999;
border-color: #999999;
}
.nav li.dropdown.open .caret,
.nav li.dropdown.open.active .caret,
.nav li.dropdown.open a:hover .caret,
.nav li.dropdown.open a:focus .caret {
border-top-color: #ffffff;
border-bottom-color: #ffffff;
opacity: 1;
filter: alpha(opacity=100);
}
// SNIPPET:
<div class=\"navbar-wrapper\">
<!-- Wrap the .navbar in .container to center it within the absolutely positioned parent. -->
<div class=\"container\">
<div class=\"navbar navbar-inverse\">
<div class=\"navbar-inner\">
<!-- Responsive Navbar Part 1: Button for triggering responsive navbar (not covered in tutorial). Include responsive CSS to utilize. -->
<button type=\"button\" class=\"btn btn-navbar\" data-toggle=\"collapse\" data-target=\".nav-collapse\">
<span class=\"icon-bar\"></span>
<span class=\"icon-bar\"></span>
<span class=\"icon-bar\"></span>
</button>
<img class=\"brand\" source=\"assets/images/logo.jpg\"></img>
<!-- Responsive Navbar Part 2: Place all navbar contents you want collapsed withing .navbar-collapse.collapse. -->
<div class=\"nav-collapse collapse\">
<ul class=\"nav\">
<li class=\"active\"><a href=\"index.html\">Home</a></li>
<li><a href=\"contact.html\">Contact</a></li>
<!-- Read about Bootstrap dropdowns at http://twbs.github.com/bootstrap/javascript.html#dropdowns -->
<li class=\"dropdown\">
<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">Expos <b class=\"caret\"></b></a>
<ul class=\"dropdown-menu\">
<li class=\"nav-header\">Texas Expositions</li>
<li><a href=\"#\">Longview</a></li>
<li><a href=\"#\">Houston</a></li>
<li><a href=\"#\">Austin</a></li>
<li><a href=\"#\">Midland</a></li>
<li class=\"divider\"></li>
<li class=\"nav-header\">Other Expositions</li>
<li><a href=\"#\">Louisiana</a></li>
<li><a href=\"#\">Oklahoma</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!-- /.navbar-inner -->
</div><!-- /.navbar -->
</div> <!-- /.container -->
</div><!-- /.navbar-wrapper -->
// SNIPPET:
/* CUSTOMIZE THE NAVBAR
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
-- */
/* Special class on .container surrounding .navbar, used for positioning it into place. */
.navbar-wrapper {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 10;
margin-top: 20px;
margin-bottom: -90px; /* Negative margin to pull up carousel. 90px is roughly margins and height of navbar. */
}
.navbar-wrapper .navbar {
}
/* Remove border and change up box shadow for more contrast */
.navbar .navbar-inner {
border: 0;
-webkit-box-shadow: 0 2px 10px rgba(0,0,0,.25);
-moz-box-shadow: 0 2px 10px rgba(0,0,0,.25);
box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
/* Downsize the brand/project name a bit */
.navbar .brand {
padding: 14px 20px 16px; /* Increase vertical padding to match navbar links */
font-size: 16px;
font-weight: bold;
text-shadow: 0 -1px 0 rgba(0,0,0,.5);
}
/* Navbar links: increase padding for taller navbar */
.navbar .nav > li > a {
padding: 15px 20px;
}
/* Offset the responsive button for proper vertical alignment */
.navbar .btn-navbar {
margin-top: 10px;
}
/* CUSTOMIZE THE CAROUSEL
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
-- */
/* Carousel base class */
.carousel {
margin-bottom: 60px;
}
.carousel .container {
position: relative;
z-index: 9;
}
.carousel-control {
height: 80px;
margin-top: 0;
font-size: 120px;
text-shadow: 0 1px 1px rgba(0,0,0,.4);
background-color: transparent;
border: 0;
z-index: 10;
}
.carousel .item {
height: 500px;
}
.carousel img {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
height: 500px;
}
.carousel-caption {
background-color: transparent;
position: static;
max-width: 550px;
padding: 0 20px;
margin-top: 200px;
}
.carousel-caption h1,
.carousel-caption .lead {
margin: 0;
line-height: 1.25;
color: #fff;
text-shadow: 0 1px 1px rgba(0,0,0,.4);
}
.carousel-caption .btn {
margin-top: 10px;
}
/* MARKETING CONTENT
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
-- */
/* Center align the text within the three columns below the carousel */
.marketing .span4 {
text-align: center;
}
.marketing h2 {
font-weight: normal;
}
.marketing .span4 p {
margin-left: 10px;
margin-right: 10px;
}
/* Featurettes
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
- */
.featurette-divider {
margin: 80px 0; /* Space out the Bootstrap <hr> more */
}
.featurette {
padding-top: 120px; /* Vertically center images part 1: add padding above and below text. */
overflow: hidden; /* Vertically center images part 2: clear their floats. */
}
.featurette-image {
margin-top: -120px; /* Vertically center images part 3: negative margin up the image the same amount of the padding to center it. */
}
/* Give some space on the sides of the floated elements so text doesn't run right into it. */
.featurette-image.pull-left {
margin-right: 40px;
}
.featurette-image.pull-right {
margin-left: 40px;
}
/* Thin out the marketing headings */
.featurette-heading {
font-size: 50px;
font-weight: 300;
line-height: 1;
letter-spacing: -1px;
}
/* RESPONSIVE CSS
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
-- */
@media (max-width: 979px) {
.container.navbar-wrapper {
margin-bottom: 0;
width: auto;
}
.navbar-inner {
border-radius: 0;
margin: -20px 0;
}
.carousel .item {
height: 500px;
}
.carousel img {
width: auto;
height: 500px;
}
.featurette {
height: auto;
padding: 0;
}
.featurette-image.pull-left,
.featurette-image.pull-right {
display: block;
float: none;
max-width: 40%;
margin: 0 auto 20px;
}
}
@media (max-width: 767px) {
.navbar-inner {
margin: -20px;
}
.carousel {
margin-left: -20px;
margin-right: -20px;
}
.carousel .container {
}
.carousel .item {
height: 300px;
}
.carousel img {
height: 300px;
}
.carousel-caption {
width: 65%;
padding: 0 70px;
margin-top: 100px;
}
.carousel-caption h1 {
font-size: 30px;
}
.carousel-caption .lead,
.carousel-caption .btn {
font-size: 18px;
}
.marketing .span4 + .span4 {
margin-top: 40px;
}
.featurette-heading {
font-size: 30px;
}
.featurette .lead {
font-size: 18px;
line-height: 1.5;
}
}
</style>
// SNIPPET:
<script type=\"text/template\" id=\"login-template\">
<nav class=\"navbar navbar-inverse navbar-fixed-top\">
<div class=\"container\">
<div class=\"navbar-header\">
<button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\">
<span class=\"sr-only\">Toggle navigation</span>
<span class=\"icon-bar\"></span>
<span class=\"icon-bar\"></span>
<span class=\"icon-bar\"></span>
</button>
<a class=\"navbar-brand\" href=\"#\">SwipteIt</a>
</div>
<div id=\"navbar\" class=\"navbar-collapse collapse\">
<form class=\"navbar-form navbar-right\">
<div class=\"form-group\">
<input type=\"text\" placeholder=\"Email\" class=\"form-control\" id=\"LoginEmail\">
</div>
<div class=\"form-group\">
<input type=\"password\" placeholder=\"Password\" class=\"form-control\" id=\"LoginPassword\">
</div>
<button type=\"submit\" class=\"btn btn-success\" id=\"loginButton\" >Sign in</button>
<div class=\"form-group\">
<a href=\"signup.html\"><span class=\"glyphicon glyphicon-user\"></span> Sign Up</a>
</div>
</form>
</div><!--/.navbar-collapse -->
</div>
</nav>
</script>
var LogInView = Backbone.View.extend({
events: {
\"click #loginButton\": \"logIn\",
// \"submit form.signup-form\": \"signUp\"
},
el: \".content\",
initialize: function() {
_.bindAll(this, \"logIn\");
this.render();
},
logIn: function(e) {
alert(\"hello world\");
// return false;
},
render: function() {
this.$el.html(_.template($(\"#login-template\").html()));
}
});
new LogInView();
// SNIPPET:
window.XMLHttpRequest
// SNIPPET:
status = 0
// SNIPPET:
var url = \"http://177.55.99.146:8080/autenticacao/autentica?arquivo=\" + file;
req.open(\"Get\", url, true);
req.send(null);
// SNIPPET:
function example(){
var exampleVar = nodes.classfication;
//below i use exampleVar to do calculations
.
.
.
.
}
// SNIPPET:
function example(){
var exampleVar = nodes.status;
//below i use exampleVar to do calculations
.
.
.
.
}
// SNIPPET:
function example(thisAttribute){
var exampleVar = nodes.thisAttribute; //using the variable passed to the function
//below i use exampleVar to do calculations
.
.
.
.
}
// SNIPPET:
<?php echo $search; ?>
// SNIPPET:
http://localhost/opencart/index.php?route=product/search&search=macbook
// SNIPPET:
<a href=\"sms:&body=Let\\'s%20connect%20near\">Link</a>
// SNIPPET:
<a href=\"sms:12345678&body=Let\\'s%20connect%20near\">Link</a>
// SNIPPET:
function something(url) {
var temp = getPage(url);
console.log(temp);
}
function getPage(url) {
var x = new XMLHTTPRequest();
x.onload = function() {
var html = x.responseText;
//CODE TO PARSE HTML TEXT
var variable = SOMETHING PARSED FROM HTML
return variable;
}
x.open(\"GET\", url);
x.send();
}
// SNIPPET:
html5mode
// SNIPPET:
html5mode
// SNIPPET:
$(\"input[name='nameCheckbox']\").each(function()
{
var object = creatObject($(this).val());
$(this).change(function()
{
if($(this).is(':checked'))
{
var object = creatObject($(this).val());
}
else
{
object.remove();
}
});
});
// SNIPPET:
$(\"[name='allCheck']\").change(function()
{
var selectAll = false;
if($(this).is(\":checked\"))
{
selectAll = true;
}
$(\"input[name='nameCheckbox']\").each(function()
{
if(selectAll)
{
$(this).prop('checked',true);
}
else
{
$(this).prop('checked',false);
}
//And here i want to do something like $(this).change();
});
});
// SNIPPET:
<af:form id=\"mainForm\">
<af:panelStretchLayout id=\"psl1\">
<!-- page layout -->
</af:panelStretchLayout>
<af:popup id=\"myPopup\"
binding=\"#{bkBean.myPopup}\"
contentDelivery=\"lazyUncached\">
<af:dialog id=\"myDialog\" closeIconVisible=\"true\"
modal=\"true\" okVisible=\"true\" cancelVisible=\"true\"
title=\"Import from server to #{bkBean.file.name}\"
type=\"okCancel\"
dialogListener=\"#{bkBean.doSomething}\">
<af:panelFormLayout id=\"pfl1\">
<!-- Several input text here -->
</af:panelFormLayout>
</af:dialog>
</af:popup>
</af:form>
// SNIPPET:
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@Name(\"exportImportServer\")
@Scope(ScopeType.SESSION)
public class ExportImportServerBean implements Cleanable {
public void importFromServer(DialogEvent event) {
if (event.getOutcome() == DialogEvent.Outcome.ok) {
}
}
}
// SNIPPET:
PhaseListener beforePhase(PhaseEvent phaseEvent)
// SNIPPET:
PhaseListener beforePhase(PhaseEvent phaseEvent)
// SNIPPET:
<af:document>
<af:form id=\"mainForm\">
<af:panelStretchLayout id=\"psl1\" topHeight=\"auto\" bottomHeight=\"0\">
<f:facet name=\"center\">
<af:region id=\"myRegion\" showHeader=\"never\"
value=\"#{main.regionModel}\" />
</f:facet>
</af:panelStretchLayout>
</af:form>
<af:popup id=\"myPopup\"
binding=\"#{bkBean.myPopup}\"
contentDelivery=\"lazyUncached\">
<af:dialog id=\"myDialog\" closeIconVisible=\"true\"
modal=\"true\" okVisible=\"true\" cancelVisible=\"true\"
title=\"Import from server to #{bkBean.file.name}\"
type=\"okCancel\"
dialogListener=\"#{bkBean.doSomething}\">
<af:panelFormLayout id=\"pfl1\">
<!-- Several input text here -->
</af:panelFormLayout>
</af:dialog>
</af:popup>
</af:document>
// SNIPPET:
<?xml version='1.0' encoding='UTF-8'?>
<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"
xmlns:ui=\"http://java.sun.com/jsf/facelets\"
xmlns:h=\"http://java.sun.com/jsf/html\"
xmlns:f=\"http://java.sun.com/jsf/core\"
xmlns:trh=\"http://myfaces.apache.org/trinidad/html\"
xmlns:tr=\"http://myfaces.apache.org/trinidad\"
xmlns:af=\"http://xmlns.oracle.com/adf/faces/rich\">
<af:tree ...>
</af:tree>
<!-- Contextual Menu -->
<af:popup id=\"pp1\" contentDelivery=\"lazyUncached\">
<af:menu>
<af:commandMenuItem text=\"Do something\" immediate=\"true\"
rendered=\"#{bkBean2.isRendered}\" icon=\"icon.png\" actionListener=\"#{bkBean2.showMyPopup}\" />
</af:menu>
</af:popup>
</ui:composition>
// SNIPPET:
function codeAddress(){
var address = document.getElementById('Zona').value;
geocoder.geocode( { 'address': address}, function(results, status){
if (status == google.maps.GeocoderStatus.OK){
map.setCenter(results[0].geometry.location);
coordo = results[0].geometry.location;
}else{
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
// SNIPPET:
geocoder.geocode( { 'address': address}, function(results, status)
// SNIPPET:
var el = $('ul.nav-menu > li > ul > li > ul')[0];
$('ul.nav-menu > li > ul > li').hover(function(){
if(!isElemInViewport(el)){
el.addClass('move-left');
}
}, function(){
if(!isElemInViewport(el)){
el.removeClass('move-left');
}
})
// SNIPPET:
var n1;
var n2;
function Restart() {
n1= Number(prompt(\"Enter a number\", \"\"));
n2= Number(prompt(\"Enter another number\", \"\"));
return (n1, n2);
}
function Add() {
n1+n2;
alert(n1+n2);
}
// SNIPPET:
<script type=\"text/javascript\" src=\"js/playAudio.js\"></script>
<script type=\"text/javascript\">
var listenString = \"12\";
var timeout = false;
var currentStringOrder = 0;
function play()
{
if(currentStringOrder == 0)
{
if(listenString[0] == \"1\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/1.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"2\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/2.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"3\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/3.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"4\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/4.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"5\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/5.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"6\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/6.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"7\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/7.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"8\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/8.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"9\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/9.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"A\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/a.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"B\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/b.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"C\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/c.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"D\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/d.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"E\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/e.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"F\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/f.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"G\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/g.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"H\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/h.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"I\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/i.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"J\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/j.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"K\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/k.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"L\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/l.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"M\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/m.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"N\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/n.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"O\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/o.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"P\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/p.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"Q\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/q.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"R\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/r.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"S\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/s.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"T\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/t.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"U\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/u.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"V\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/v.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"W\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/w.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"X\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/x.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"Y\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/y.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
else if(listenString[0] == \"Z\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/z.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 1;
}
}
else if(currentStringOrder == 1)
{
if(listenString[1] == \"1\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/1.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"2\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/2.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"3\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/3.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"4\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/4.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"5\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/5.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"6\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/6.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"7\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/7.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"8\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/8.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"9\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/9.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"A\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/a.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"B\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/b.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"C\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/c.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"D\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/d.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"E\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/e.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"F\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/f.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"G\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/g.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"H\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/h.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"I\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/i.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"J\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/j.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"K\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/k.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"L\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/l.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"M\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/m.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"N\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/n.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"O\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/o.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"P\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/p.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"Q\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/q.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"R\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/r.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"S\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/s.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"T\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/t.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"U\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/u.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"V\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/v.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"W\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/w.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"X\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/x.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"Y\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/y.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
else if(listenString[1] == \"Z\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/z.mp3\");
setTimeout(play(), 1000);
currentStringOrder = 2;
}
}
else if(currentStringOrder == 2)
{
if(listenString[2] == \"1\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/1.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"2\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/2.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"3\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/3.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"4\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/4.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"5\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/5.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"6\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/6.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"7\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/7.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"8\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/8.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"9\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/9.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"A\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/a.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"B\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/b.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"C\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/c.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"D\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/d.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"E\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/e.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"F\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/f.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"G\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/g.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"H\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/h.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"I\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/i.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"J\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/j.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"K\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/k.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"L\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/l.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"M\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/m.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"N\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/n.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"O\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/o.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"P\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/p.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"Q\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/q.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"R\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/r.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"S\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/s.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"T\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/t.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"U\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/u.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"V\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/v.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"W\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/w.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"X\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/x.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"Y\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/y.mp3\");
currentStringOrder = 3;
}
else if(listenString[2] == \"Z\")
{
playAudio(audioToPlay = \"../scripts/captcha/soundtracks/z.mp3\");
currentStringOrder = 3;
}
}
}
</script>
// SNIPPET:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
</head>
<body>
<div id=\"options\">
<ul id=\"list\" style=\"\">
<li>ABOUT</li>
</br>
<li>THE STREAM</li>
</br>
<li>TELL YOUR STORY</li>
</br>
<li>COMING EVENTS</li>
</br>
<li>CONTACT</li>
</ul>
</div>
<div id=\"sentences_block\">
<div id=\"elements\" style=\"margin-left:50px;\"></div>
<div>
</body>
<style type=\"text/css\">
.letter {
font-family: sans-serif;
font-size: 40px;
font-weight: bold;
position: absolute;
top: -100px;
left: 0px;
}
#list {
list-style-type: none;
color: #0067CE;font-weight: bold;
font-style:arial;
font-size:15px;
float:right;
}
#options {
margin-right:20px;
}
</style>
<script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js\" type=\"text/javascript\" charset=\"utf-8\"></script>
<script type=\"text/javascript\">
$(document).ready(function() {
var width = $(window).width() - 0;
var starttime = new Date().getTime();
var letters = document.location.hash ? document.location.hash.substr(1) : 'sentence';
var elements = $('#elements');
for (i = 0; i < letters.length; i++) {
$('<div>', {
html: letters[i]
})
.addClass('letter')
.appendTo(elements);
}
function run() {
var elapsed = new Date().getTime() - starttime;
var pos = elapsed * 0.2;
$('div.letter').each(function(index, letter) {
var posx = (pos + 40 * index) % width;
var posy = 200 + Math.sin(posx / 50) *25;
$(letter).css('left', posx + 'px');
$(letter).css('top', posy + 'px');
});
}
setInterval(run, 3);
});
</script>
</html>
// SNIPPET:
href
// SNIPPET:
<a href=\"somelinks\">Click Me</a>
// SNIPPET:
$('a').attr('href').hide();
// SNIPPET:
href
// SNIPPET:
SC.initialize({
client_id: 'b5ec05bfa8844fff9b84362925f46745'
});
var soundcloud_track;
SC.get('/tracks/202764956', {}, function(track){
soundcloud_track = track.stream_url+'?client_id=b5ec05bfa8844fff9b84362925f46745';
streamTrack();
});
function streamTrack(){
soundManager.setup = {
preferFlash: true,
}
soundManager.flash9Options = {
usePeakData: true, // enable left/right channel peak (level) data
useWaveformData: true, // enable sound spectrum (raw waveform data) - WARNING: May set CPUs on fire.
useEQData: true, // enable sound EQ (frequency spectrum data) - WARNING: Also CPU-intensive.
}
var sound = soundManager.createSound({
url: soundcloud_track,
autoPlay: true,
onplay: function(){
console.log(soundManager.features);
},
whileplaying: function(){
console.log(sound.peakData);
}
});
}
// SNIPPET:
@Html.PasswordFor(m => m.Password, new { @Value = \"********\"})
// SNIPPET:
.factory('getArticles', function ($http, $q) {
return {
abc : function() {
var deferred = $q.defer();
// my code
res= this. bcd();
console.log(res); // undefined
deferred.resolve(res);
return deferred.promise;
},
bcd: function() {
//some codee
return res;
}
}
});
// SNIPPET:
{| x |} - {| y |}
// SNIPPET:
x
// SNIPPET:
y
// SNIPPET:
var item = {x: 20, y: 50};
var _s = $interpolate.startSymbol();
var _e = $interpolate.endSymbol();
$interpolate.startSymbol(\"{|\");
$interpolate.endSymbol(\"|}\");
var fmt = attrs.itemLabel;
console.log(fmt, item);
var _interpolated = $interpolate(fmt)(item);
console.log(_interpolated);
$interpolate.startSymbol(_s);
$interpolate.endSymbol(_e);
// SNIPPET:
item_id:
[{item_id:1,...},{item_id:2,...}...]
// SNIPPET:
item_ids:
[2, 8, 10]
// SNIPPET:
item_id
// SNIPPET:
item_ids
// SNIPPET:
var fileReader=new FileReader();
fileReader.onload=function(event){
$rootScope.$broadcast('event:file:selected',{image:event.target.result});
Image64b = event.target.result;
// $scope.ImageNo2 = Image64b;
// var replaceStr = \"data:image/png\"
// resultPdfbase64 = Image64a.replace(\"data:image/jpeg\", replaceStr);
// $scope.ImageNo2 = resultPdfbase64;
var imgObj = new Image();
imgObj.src = Image64b ;
var canvas = document.createElement(\"canvas\");
canvas.width = 225;
canvas.height = 225;
canvas.getContext(\"2d\").drawImage(imgObj, 0, 0,225,225);
$scope.imgggg2 = canvas.toDataURL(\"image/jpeg\");
$scope.$apply();
}
fileReader.readAsDataURL(file);
$scope.imggg2 used for base64 string in this $scope.imggg2 always value becomes data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/7QA4UGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAAA4QklNBCUAAAAAABDUHYzZjwCyBOmACZjs+EJ+/8AAEQgA4QDhAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/bAEMAAgICAgICAwICAwUDAwMFBgUFBQUGCAYGBgYGCAoICAgICAgKCgoKCgoKCgwMDAwMDA4ODg4ODw8PDw8PDw8PD//bAEMBAgICBAQEBwQEBxALCQsQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEP/dAAQAD//aAAwDAQACEQMRAD8A/n/ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigD/0P5/6KKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H+f+iiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP/S/n/ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigD/0/5/6KKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T+f+iiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP/V/n/ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigD/1v5/6KKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f+f+iiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP/Q/n/ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigD/0f5/6KKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L+f+iiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP/T/n/ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigD/1P5/6KKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X+f+iiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP/Z\"
// SNIPPET:
<input type=\"checkbox\" value=\"Y\" id=userActive checked>
// SNIPPET:
if (ra.active=='Y') {
$(\"#userActive\").prop(\"checked\",true);
} else {
$(\"#userActive\").prop(\"checked\",false);
}
// SNIPPET:
<script> //To expand an image back to full size
$(document).ready(function(){
$(\"img\").click(function(){
$(this).css(\"width\",\"100%\");
});
});
</script>
// SNIPPET:
<div>
<img class=\"shrink thick-border\" src=\"img/bentley.jpg\">
</div>
<div>
<img class=\"shrink thick-border\" src=\"img/classic.jpg\">
</div>
<div>
<img class=\"shrink thick-border\" src=\"img/ferrari.jpg\">
</div>
<div>
<img class=\"shrink thick-border\" src=\"img/maseratti.jpg\">
</div>
// SNIPPET:
//when the send button is pushed
sendelem.on(\"mousedown\", function() {
var send = $(this).data('sent');
console.log(\"mouse pressed down\");
....
});
// SNIPPET:
//when the send button is pushed
sendelem.mousedown(function() {
var send = $(this).data('sent');
console.log(\"mouse pressed down\");
...
});
// SNIPPET:
//when the send button is pushed
$(sendelem).mousedown(function() {
var send = $(this).data('sent');
console.log(\"mouse pressed down\");
...
});
// SNIPPET:
ExernalInterface
// SNIPPET:
//External Timer and Handler
var externaltimer: Timer = new Timer(1000);
externaltimer.addEventListener(TimerEvent.TIMER, callTimerJS);
externaltimer.start();
function callTimerJS(event : Event):void{
ExternalInterface.call(\"window.clearTimeout\");
ExternalInterface.call(\"timeoutHandle\");
}
// SNIPPET:
var timeoutHandle = window.setTimeout(function() {
window.location.reload(1);
}, 15000);
window.clearTimeout(timeoutHandle);
timeoutHandle = window.setTimeout(function() {
window.location.reload(1);
}, 15000);
// SNIPPET:
jQuery(document).ready(function () {
jQuery(\".checkboxes\").hide();
//toggle the componenet with class msg_body
jQuery(\".Select\").click(function () {
jQuery(this).next(\".checkboxes\").slideToggle(500);
if ($(\".select\").text() == \"+\") {
alert('hi');
$(\".select\").html() == \"-\"
}
else {
$(\".select\").text() == \"+\";
}
return false;
});
});
// SNIPPET:
$('.klass').change(function () { ... });
// SNIPPET:
$(document).on('change', '.klass', function () { ... });
// SNIPPET:
$(document).on('event', 'jquery-selector', function () { ... });
// SNIPPET:
> calEvent.start
Moment {_isAMomentObject: true, _i: \"2015-06-11T11:00:00\", _f: \"YYYY-MM-DDTHH:mm:ss\", _isUTC: false, _pf: Object…}_ambigTime: false_ambigZone: false_d: Thu Jun 11 2015 11:00:00 GMT+0300 (EEST)_f: \"YYYY-MM-DDTHH:mm:ss\"_fullCalendar: true_i: \"2015-06-11T11:00:00\"_isAMomentObject: true_isUTC: false_isValid: true_locale: f_offset: 0_pf: Object__proto__: Moment
> dateTime.startDT
Moment {_isAMomentObject: true, _i: \"Th, 11-06-2015 11:00\", _f: \"dd, DD-MM-YYYY HH:mm\", _isUTC: false, _pf: Object…}_d: Thu Jun 11 2015 11:00:00 GMT+0300 (EEST)_f: \"dd, DD-MM-YYYY HH:mm\"_i: \"Th, 11-06-2015 11:00\"_isAMomentObject: true_isUTC: false_isValid: true_locale: Object_pf: Object__proto__: Moment
// SNIPPET:
> calEvent.start.format('YYYY-MM-DDTHH:mm')
\"2015-06-11A11:00\"
^
A? what is that? i was expecting 'T'
> dateTime.startDT.format('YYYY-MM-DDTHH:mm')
\"2015-06-11T11:00\"
^
This is correct one for me.
// SNIPPET:
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js\"></script>
<ol id=\"boxes\">
</ol>
<input type=\"button\" value=\"Add a row\" id=\"add_boxes\" />
<br> final result of all 3rd boxes:
<input type=\"text\" value=\"\" id=\"final_result\" />
<script>
var add = $('#add_boxes');
var all = $('#boxes');
var amountOfInputs = 2;
var maximumBoxes = 10;
add.click(function(event) {
// create a limit
if ($(\".box\").length >= maximumBoxes) {
alert(\"You cannot have more than 10 boxes!\");
return;
}
var listItem = $('<li class=\"box\"></li>');
// we will add 2 boxes here, but we can modify this in the amountOfBoxes value
for (var i = 0; i < amountOfInputs; i++) {
listItem.append('<input type=\"text\" class=\"input\" />');
}
listItem.append('<input type=\"text\" class=\"output\" name=\"value\" placeholder=\"3rd box\"/>');
// Lets add a link to remove this group as well, with a removeGroup class
listItem.append('<input type=\"button\" value=\"Remove\" class=\"removeGroup\" />')
listItem.appendTo(all);
});
// This will tie in ANY input you add to the page. I have added them with the class `input`, but you can use any class you want, as long as you target it correctly.
$(document).on(\"keyup\", \"input.input\", function(event) {
// Get the group
var group = $(this).parent();
// Get the children (all that arent the .output input)
var children = group.children(\"input:not(.output)\");
// Get the input where you want to print the output
var output = group.children(\".output\");
// Set a value
var value = 0;
// Here we will run through every input and add its value
children.each(function() {
// Add the value of every box. If parseInt fails, add 0.
value += parseInt(this.value) || 0;
var a = parseInt(value);
});
// Print the output value
output.val(value);
document.getElementById('final_result').value = value;
var test = document.getElementById('final_result').value
var b = parseInt(test) + parseInt(a);
alert(a);
});
// Lets implement your remove field option by removing the groups parent div on click
$(document).on(\"click\", \".removeGroup\", function(event) {
event.preventDefault();
$(this).parent(\".box\").remove();
});
</script>
// SNIPPET:
<form data-abide>
<ul class=\"tabs\" data-tab>
<li class=\"tab-title active\"><a href=\"#panel1\">Tab Name</a></li>
<li class=\"tab-title\"><a href=\"#panel2\">Tab Email</a></li>
</ul>
<div class=\"tabs-content\">
<div class=\"content active\" id=\"panel1\">
<div class=\"name-field\">
<label>Your name <small>required</small>
<input type=\"text\" required pattern=\"[a-zA-Z]+\">
</label>
<small class=\"error\">Name is required and must be a string.</small>
</div>
</div>
<div class=\"content\" id=\"panel2\">
<div class=\"email-field\">
<label>Email <small>required</small>
<input type=\"email\" required>
</label>
<small class=\"error\">An email address is required.</small>
</div>
</div>
</div>
<button type=\"submit\">Submit</button>
</form>
<script>
$(document).foundation();
</script>
// SNIPPET:
/api/v2/
// SNIPPET:
version2
// SNIPPET:
version1
// SNIPPET:
version1
// SNIPPET:
version2
// SNIPPET:
var version1 = require('./routes/vers1');
var version2 = require('./routes/vers2');
module.exports = function(app) {
app.all('/api/v2/*', version2);
app.all('/*', version1);
};
// SNIPPET:
jquery autocomplete
// SNIPPET:
jquery autocomplete
// SNIPPET:
$(document).ready(function(){
$(\"#m_occupation\").autocomplete(\"search/moccupation.php\", {
selectFirst: true
});
$(\"#foccupation\").autocomplete(\"search/f_occupation.php\", {
selectFirst: true
});
$(\"#g_address\").autocomplete(\"search/g_address.php\", {
selectFirst: true
});
$(\"#relationship\").autocomplete(\"search/relationship.php\", {
selectFirst: true
});
});
// SNIPPET:
<div class=\"box\">
<span class=\"fit\">what</span>
<span class=\"fit\">an</span>
<span class=\"fit\">idea!</span>
</div>
.box{
width: 50%;
background: beige;
text-align: center;
}
.fit{
display: block;
}
// SNIPPET:
getAvatarUrl: function(avatar, type) {
if (!manifest[avatar])
avatar = 'base01';
var version = manifest[avatar][type];
return base_url + \"/\" + avatar + type + \".\" + version + \".png\";
}
// SNIPPET:
getAvatarUrl: function() {
return \"Custom Image url\";
}
// SNIPPET:
var div;
function onMouseMove (e) {
div.height(parseInt(e.pageY) - parseInt(div.css(\"top\")) );
div.width( parseInt(e.pageX) - parseInt(div.css(\"left\")));
console.log(div.width());
console.log(div.height());
};
$(document).on(\"mousedown\", function(e){
div = $(\"<div></div>\").prependTo(\"body\");
div.css({
\"top\": e.pageY,
\"left\": e.pageX
});
$(this).on(\"mousemove\", onMouseMove);
});
$(document).on(\"mouseup\", function(){
setTimeout(function(){
div.remove();
}, 1000);
$(this).off(\"mousemove\", onMouseMove);
});
// SNIPPET:
@model MaLog.NET.Models.ChartModel
@{
ViewBag.Title = @Layouts.Layouts.Chart;
Layout = \"~/Views/Shared/_Layout.cshtml\";
}
<div class=\"Post postHeader firstPost\" >
@using (Html.BeginForm(\"ChartDisplay\", \"Chart\", FormMethod.Post, new { id = \"SelectPagesForm\" }))
{
// Difinition af dropdownlister @Layouts.Layouts.SelectAllLinacs, definere overskriften....
<div id=\"EntitySelectDiv\" >
@Html.DropDownList(\"EntityId\", (SelectList)ViewBag.Entities, @Layouts.Layouts.SelectAllLinacs)
</div>
<div id=\"PageSelectDiv\" >
@Html.DropDownList(\"PageId\", (SelectList)ViewBag.Pages, @Layouts.Layouts.SelectAllPages)
</div>
<div id=\"EnergySelectDiv\" >
@Html.DropDownList(\"EnergyId\", (SelectList)ViewBag.Energies, @Layouts.Layouts.SelectAllEnegries)
</div>
<div id=\"ItemSelectDiv\" >
@Html.DropDownList(\"ItemId\", (SelectList)ViewBag.Items, @Layouts.Layouts.SelectAllItems)
</div>
<div id =\"Item2SelectDiv\">
@Html.DropDownList(\"ItemId2\", (SelectList)ViewBag.Items, @Layouts.Layouts.SelectAllItems)
</div>
<div>
<input type=\"checkbox\" name=\"CompareAdmin\" value=\"True\" id=\"compareadmin\">
</div>
<div>Samlign</div>
//Opdater Knappen (viser Chartet)
<ul class=\"menu floatLeft\">
<li><a href=\"#\" onclick=\"$('#SelectPagesForm').submit()\">@Layouts.Layouts.Update</a></li>
</ul>
}
</div>
@if (Model != null)
{
string Entitytemp = Model.Entity;
string Pagetemp = Model.Page;
string Energytemp = Model.Energy;
string Itemtemp = Model.Item;
if (Itemtemp == \" \")
{
ViewBag.Error = \"Error: Item list ikke aflæst korrekt eller mangler at vælge et Item.\";
}
else if (Entitytemp == \" \")
{
ViewBag.Error = \"Error: Accelerator list ikke aflæst korrekt eller mangler at vælge en Accelerator.\";
}
else if (Pagetemp == \" \")
{
ViewBag.Error = \"Error: Side list ikke aflæst korrekt eller mangler at vælge en Side.\";
}
else if (Energytemp == \" \")
{
ViewBag.Error = \"Error: Energi list ikke aflæst korrekt eller mangler at vælge en Energi.\";
}
else
{
<div class=\"parameterchart\">
<img src=\"@Url.Action(\"MalogChart\", new { MainGroupID = 1, Entity = Model.Entity, Page = Model.Page, Energy = Model.Energy, Item = Model.Item })\" alt=\"ViewChart\" />
</div>
}
}
// SNIPPET:
<script type=\"text/javascript\">
$(document).ready(function () {
$('select#ItemId2 > option[value=]').attr('value', ' ');
if ($('#compareadmin').is(\":checked\")) {
//show the hidden div
$('#ItemId2').show(\"fast\");
}
else {
//otherwise, hide it
$('#ItemId2').hide(\"fast\");
}
$('#compareadmin').click(function () {
if (this.checked) {
$('select#ItemId2').combobox({
selected: function (event, ui) {
$('#AjaxLoader').show(\"fast\");
$.post('@Url.Action(\"AjaxGetEntitiesList\", \"Chart\")', { Page: $('select#PageId :selected').val(), Energy: $('select#EnergyId :selected').val() }, function (data) {
AJaxUpdateEntitiesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
$.post('@Url.Action(\"AjaxGetEnergiesList\", \"Chart\")', { Entity: $('select#EntityId :selected').val(), Page: $('select#PageId :selected').val() }, function (data) {
AJaxUpdateEnergiesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
$.post('@Url.Action(\"AjaxGetPagesList\", \"Chart\")', { Entity: $('select#EntityId :selected').val(), Energy: $('select#EnergyId :selected').val() }, function (data) {
AJaxUpdatePagesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
}
})
}
else{
$('select#ItemId2').hide(\"fast\");
}
});
$('select#EntityId > option[value=]').attr('value', ' ');
$('select#EntityId').combobox({
selected: function (event, ui) {
$('#AjaxLoader').show();
$.post('@Url.Action(\"AjaxGetPagesList\", \"Chart\")', { Entity: $('select#EntityId :selected').val(), Energy: $('select#EnergyId :selected').val() }, function (data) {
AJaxUpdatePagesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
$.post('@Url.Action(\"AjaxGetEnergiesList\", \"Chart\")', { Entity: $('select#EntityId :selected').val(), Page: $('select#PageId :selected').val() }, function (data) {
AJaxUpdateEnergiesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
$.post('@Url.Action(\"AjaxGetItemsList\", \"Chart\")', { Entity: $('select#EntityId :selected').val(), Page: $('select#PageId :selected').val(), Energy: $('select#EnergyId :selected').val() }, function (data) {
AJaxUpdateItemsList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
}
});
//$('input#EntityId_').val($('select#EntityId > option[value=]').text());
$('select#PageId > option[value=]').attr('value', ' ');
$('select#PageId').combobox({
selected: function (event, ui) {
$('#AjaxLoader').show();
$.post('@Url.Action(\"AjaxGetEntitiesList\", \"Chart\")', { Page: $('select#PageId :selected').val(), Energy: $('select#EnergyId :selected').val() }, function (data) {
AJaxUpdateEntitiesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
$.post('@Url.Action(\"AjaxGetEnergiesList\", \"Chart\")', { Entity: $('select#EntityId :selected').val(), Page: $('select#PageId :selected').val() }, function (data) {
AJaxUpdateEnergiesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
$.post('@Url.Action(\"AjaxGetItemsList\", \"Chart\")', { Entity: $('select#EntityId :selected').val(), Page: $('select#PageId :selected').val(), Energy: $('select#EnergyId :selected').val() }, function (data) {
AJaxUpdateItemsList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
}
});
//$('input#PageId_').val($('select#PageId > option[value=]').text());
$('select#EnergyId > option[value=]').attr('value', ' ');
$('select#EnergyId').combobox({
selected: function (event, ui) {
$('#AjaxLoader').show();
$.post('@Url.Action(\"AjaxGetPagesList\", \"Chart\")', { Entity: $('select#EntityId :selected').val(), Energy: $('select#EnergyId :selected').val() }, function (data) {
AJaxUpdatePagesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
$.post('@Url.Action(\"AjaxGetEntitiesList\", \"Chart\")', { Page: $('select#PageId :selected').val(), Energy: $('select#EnergyId :selected').val() }, function (data) {
AJaxUpdateEntitiesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
$.post('@Url.Action(\"AjaxGetItemsList\", \"Chart\")', { Entity: $('select#EntityId :selected').val(), Page: $('select#PageId :selected').val(), Energy: $('select#EnergyId :selected').val() }, function (data) {
AJaxUpdateItemsList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
}
});
//$('input#EnergyId_').val($('select#EnergyId > option[value=]').text());
$('select#ItemId > option[value=]').attr('value', ' ');
$('select#ItemId').combobox({
selected: function (event, ui) {
$('#AjaxLoader').show();
$.post('@Url.Action(\"AjaxGetEntitiesList\", \"Chart\")', { Page: $('select#PageId :selected').val(), Energy: $('select#EnergyId :selected').val() }, function (data) {
AJaxUpdateEntitiesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
$.post('@Url.Action(\"AjaxGetEnergiesList\", \"Chart\")', { Entity: $('select#EntityId :selected').val(), Page: $('select#PageId :selected').val() }, function (data) {
AJaxUpdateEnergiesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
$.post('@Url.Action(\"AjaxGetPagesList\", \"Chart\")', { Entity: $('select#EntityId :selected').val(), Energy: $('select#EnergyId :selected').val() }, function (data) {
AJaxUpdatePagesList(data);
}, \"json\").error(function (xhr, status, error) { alert(\"Status: \" + status + \", Error: \" + error); });
}
});
});
function AJaxUpdatePagesList(data) {
var selectedVal = $('#PageId option:selected').val();
$('#PageId').empty();
if (selectedVal != null) {
var firstOption = data.length > 0 ? '@Layouts.Layouts.SelectAllPages' : '@Layouts.Layouts.NoPagesAvalible';
$('#PageId').append(
$(\"<option></option>\").text(firstOption).attr(\"value\", \" \"));
}
$.each(data, function (key, val) {
$('#PageId')
.append($(\"<option></option>\")
.attr(\"value\", val.Value)
.text(val.Text));
});
$('select#PageId').val(selectedVal);
$('#PageId_').val($('select#PageId option:selected').text());
$('#AjaxLoader').hide();
}
function AJaxUpdateEntitiesList(data) {
var selectedVal = $('#EntityId option:selected').val();
$('#EntityId').empty();
if (selectedVal != null) {
var firstOption = data.length > 0 ? '@Layouts.Layouts.SelectAllLinacs' : '@Layouts.Layouts.NoEntitiesAvalible';
$('#EntityId').append(
$(\"<option></option>\").text(firstOption).attr(\"value\", \" \"));
}
$.each(data, function (key, val) {
$('#EntityId')
.append($(\"<option></option>\")
.attr(\"value\", val.Value)
.text(val.Text));
});
$('select#EntityId').val(selectedVal);
$('#EntityId_').val($('select#EntityId option:selected').text());
$('#AjaxLoader').hide();
}
function AJaxUpdateEnergiesList(data) {
var selectedVal = $('#EnergyId option:selected').val();
$('#EnergyId').empty();
if (selectedVal != null) {
var firstOption = data.length > 0 ? '@Layouts.Layouts.SelectAllEnegries' : '@Layouts.Layouts.NoEnergiesAvalible';
$('#EnergyId').append(
$(\"<option></option>\").text(firstOption).attr(\"value\", \" \"));
}
$.each(data, function (key, val) {
$('#EnergyId')
.append($(\"<option></option>\")
.attr(\"value\", val.Value)
.text(val.Text));
});
$('select#EnergyId').val(selectedVal);
$('#EnergyId_').val($('select#EnergyId option:selected').text());
$('#AjaxLoader').hide();
}
function AJaxUpdateItemsList(data) {
var selectedVal = $('#ItemId option:selected').val();
$('#ItemId').empty();
if (selectedVal != null) {
var firstOption = data.length > 0 ? '@Layouts.Layouts.SelectAllPages' : '@Layouts.Layouts.NoPagesAvalible';
$('#ItemId').append(
$(\"<option></option>\").text(firstOption).attr(\"value\", \" \"));
}
$.each(data, function (key, val) {
$('#ItemId')
.append($(\"<option></option>\")
.attr(\"value\", val.Value)
.text(val.Text));
});
$('select#ItemId').val(selectedVal);
$('#ItemId_').val($('select#ItemId option:selected').text());
$('#AjaxLoader').hide();
}
</script>
// SNIPPET:
if (lastHost == \"one.school.com\" ) {
$(\"#form_12345677-7764-48b2-9b00-a724e2d9c449_4\").prop(\"checked\", true);
} else if (lastHost == \"two.school.com\" || lastHost == \"two-stage.school.com\") {
$(\"#form_12345677-7764-48b2-9b00-a724e2d9c449_9\").prop(\"checked\", true)
}
// SNIPPET:
<script type=\"text/javascript\">
function a(a)
{
return a;
}
function b(b)
{
return b;
}
function add(a,b)
{
a();
b();
var c = a+b;
document.write(\"this is tour ans:-\"+c);
}
</script>
</head>
<body>
<form>
<input type=\"button\" onclick=\"add(10,20)\" value=\"click me.\">
</form>
</body>
</html>
// SNIPPET:
$.fn.dataTable.ext.oSort['custom'] = function (settings, col) {
return this.api().column(col, {order: 'index'}).nodes().map(function (td, i) {
var string= $(td).html();
return $.trim(string.substr(string.length - 4));
});
}
$.fn.dataTable.ext.type.detect.push(
function (value) {
var test = (/PT\\d/).test(value);
return test ? 'custom' : null;
}
);
// SNIPPET:
LargeObject
// SNIPPET:
LargeObject
// SNIPPET:
<p contenteditable=\"true\" id=\"ck\">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
// SNIPPET:
$(document).ready(function(){
CKEDITOR.disableAutoInline = true
instance = CKEDITOR.inline( \"ck\" )
});
</script>
// SNIPPET:
Fiddle
// SNIPPET:
var ss = SpreadsheetApp.getActiveSpreadsheet
var sheet = ss.getActiveSheet();
var range = sheet.getRange(\"A1:A5\");
range.value = range.value.toProperCase();
String.prototype.toProperCase= function()
{
return range.charAt(0).toUpperCase() + range.substring(1,range.length).toLowerCase();
}
// SNIPPET:
$('.brandModelLineWrapper')
// SNIPPET:
clearfix
// SNIPPET:
$('.brandModelLineWrapper').after(\"<div class='clear'></div>\")
// SNIPPET:
resolve: {
my_two_lists: function() {
return MyService.list().then(function(array1) {
return MyOtherService.list().then(function(array2) {
return new Promise(function(resolve, reject) {
resolve(array1.concat(array2));
});
});
});
}
}
// SNIPPET:
var data = {\"collection\": \"installation\",
\"timeframe\": {
\"start\": moment(date_from).format('YYYY-MM-DDTHH:mm:ss'),
\"end\": moment(date_to).format('YYYY-MM-DDTHH:mm:ss')
}};
var install_all = Insight.installations(data);
data['filters'] = [{\"property_name\": \"os\", \"operator\": \"eq\", \"property_value\": \"android\"}];
var filter_android = data;
var install_android = Insight.installations(filter_android);
data['filters'][0]['property_value'] = 'ios';
var filter_ios = data;
var install_ios = Insight.installations(filter_ios);
data['filters'][0]['property_value'] = 'windowsphone';
var filter_wp = data;
var install_windowsphone = Insight.installations(filter_wp);
$q.all({'install_all': install_all, 'install_android':install_android,
'install_ios':install_ios,'install_windowsphone':install_windowsphone})
.then(function(data){
$scope.install_all = data['install_all']['result'];
$scope.install_android = data['install_android']['result'];
$scope.install_ios = data['install_ios']['result'];
$scope.install_windowsphone = data['install_windowsphone']['result'];
}, function(errors){
console.log(\"The request failed with response\" + errors.status);
});
// SNIPPET:
{u'filters': [{u'operator': u'eq', u'property_name': u'os', u'property_value': u'windowsphone'}], u'collection': u'installation', u'timeframe': {u'start': u'2015-07-04T00:00:00', u'end': u'2015-07-04T00:00:00'}}
\"POST /admin/api/queries/count HTTP/1.1\" 200 -
// SNIPPET:
onclick
// SNIPPET:
$(\"#button\").on(\"click\",function(){
$(\"#upload\").trigger(\"click\");
});
// SNIPPET:
#upload{
opacity: 0;
}
// SNIPPET:
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>
<img id=\"button\" src=\"http://www.kafkabrigade.org.uk/wp-content/uploads/2011/07/button-pic.jpg\" />
<input id=\"upload\" type=\"file\" >
// SNIPPET:
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
var myStepDefinitionsWrapper = function () {
if(isTrue(orgDownloadCase)) {
createOrgBasic.orgDownloadCases.getAttribute('checked').then(function (checked)
{
console.log(\"Checked\" +checked);
if (checked == true) {
createOrgBasic.orgDownloadCases.click();
}
});
}
};
// SNIPPET:
min
// SNIPPET:
max
// SNIPPET:
total
// SNIPPET:
bins
// SNIPPET:
input:
min = 1
max = 4
total = 9
bins = 4
output:
1,1,3,4
1,2,2,4
1,2,3,3
2,2,2,3
// SNIPPET:
function arrSum(arr) {
var sum = 0;
for (var i = 0; i < arr.length; i++) {
sum += arr[i];
}
return sum;
}
function incrementComboArr(arr, maxNum) {
var i = arr.length - 1;
while (i >= 0) {
if (++arr[i] > maxNum) {
i--;
} else {
for (var j = i + 1; j < arr.length; j++) {
arr[j] = arr[i];
}
break;
}
}
return i === -1;
}
getSetCombos = function (minNum, maxNum, target, bins) {
var iters = 0;
var solutions = [];
var arr = [];
var i;
for (i = 0; i < bins; i++) {
arr[i] = minNum;
}
while (true) {
iters++;
var sum = arrSum(arr);
if (sum === target) {
solutions.push(arr.slice());
}
if (incrementComboArr(arr, maxNum)) break;
}
console.log(iters);
return solutions;
};
// SNIPPET:
if arr[0] > ~~(total/bins)
// SNIPPET:
//Code translated from Spektre
subsetSum = function (minNum, maxNum, target, bins) {
var start = new Date();
var solutions = [];
var arr = [];
var i;
var s;
var loop = true;
for (i = 0; i < bins; i++) {
arr[i] = minNum;
}
s = minNum * bins;
while (loop) {
if (s === target) {
solutions.push(arr.slice());
}
for (i = bins;;) {
i--;
arr[i]++;
s++;
for (var j = i + 1; j < bins; j++) {
s+= arr[i]-arr[j];
arr[j]=arr[i];
}
if ((s<=target)&&(arr[i]<=maxNum)) break;
if (!i) {
loop = false;
break;
}
s+=maxNum-arr[i];
arr[i]=maxNum;
}
}
return new Date() - start;
};
//Code translated from karthik
subsetSumRecursive = function(minNum, maxNum, target, bins) {
var start = new Date();
var solutions = [];
var arr= [], i;
var totalBins = bins;
for (i = 0; i < bins; i++) {
arr[i] = minNum;
}
target -= minNum * bins;
countWays(target, bins, arr, 0);
return new Date() - start;
function countWays(target, binsLeft, arr) {
if (binsLeft === 1) {
arr[totalBins-1] += target;
if (arr[totalBins-1] <= maxNum) {
solutions.push(arr.slice());
}
return;
}
if (target === 0 && arr[totalBins-binsLeft] <= maxNum) {
solutions.push(arr.slice());
return;
}
var binsCovered = 0;
if (target >= binsLeft) {
var newArr = arr.slice();
while (binsCovered < binsLeft) {
newArr[totalBins - binsCovered -1]++;
binsCovered++;
}
countWays(target - binsLeft, binsLeft, newArr);
}
countWays(target, binsLeft-1, arr);
}
};
subsetSum(1,4,100,32);
subsetSumRecursive(1,4,100,32);
// SNIPPET:
<html>
<title></title>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">
</head>
<body onload = \"displayProblem()\">
<script>
function displayProblem(){
var answer = (firstNum) + (secondNum);
var firstNum = (Math.floor(Math.random()*10) + 1);
var secondNum = (Math.floor(Math.random()*10) + 1);
document.getElementById(\"qstns\").innerHTML = firstNum +\" + \" + secondNum +\" = \";
}
function checkAnswer(){
var userAnswer = document.getElementById(\"answr\").value;
if(userAnswer === answer){
updateScore();
console.log(\"score updated\");
}
console.log(\"did not update score\");
// SNIPPET:
function displayNext(){
document.getElementById(\"next\").style.display = \"block\";
}
function hideNext(){
document.getElementById(\"next\").style.display = \"none\";
}
function updateScore(){
var score = 0;
score++;
document.getElementById(\"score\").innerHTML = score;
}
function clearAnswer(){
document.getElementById(\"answr\").value = \" \";
}
</script>
<div id=\"main\">
<div id=\"qstns\">
</div>
</div>
<input type=\"text\" id=\"answr\">
Score: <label id=\"score\"> 0 </label>
<button type=\"Sumbit\" id=\"submit\" onclick=\"displayNext(), checkAnswer ()\">Check</button>
<button type=\"Submit\" id=\"next\" onclick=\"displayProblem(), hideNext(), clearAnswer()\" style=\"display:none;\">Next</button>
</body>
</html>
// SNIPPET:
$(function () {
$('#container').highcharts(
{\"chart\":{\"type\":\"column\"},\"xAxis\":{
\"dateTimeLabelFormats\":{\"month\":\"%m/%e\"},
\"type\":\"datetime\"
},
\"series\":[{\"data\":[{\"x\":1406332800000.0,\"y\":358.0},
{\"x\":1408838400000.0,\"y\":417.0},{\"x\":1411344000000.0,\"y\":358.0},{\"x\":1416355200000.0,\"y\":323.0},{\"x\":1418860800000.0,\"y\":408.0},{\"x\":1421366400000.0,\"y\":280.0},{\"x\":1423872000000.0,\"y\":305.0},{\"x\":1426377600000.0,\"y\":314.0},{\"x\":1428883200000.0,\"y\":331.0},{\"x\":1431388800000.0,\"y\":412.0},{\"x\":1433894400000.0,\"y\":279.0}]}]}
);
});
// SNIPPET:
<%
response.setHeader(\"Cache-Control\", \"private, no-cache, no-store, must-revalidate\");
response.setHeader(\"Pragma\", \"no-cache\");
response.setDateHeader(\"Expires\", 0);
String userID = (String) session.getAttribute(\"userid\");
if (userID == null) {
request.setAttribute(\"loginError\", \"Session has ended. Please login.\");
RequestDispatcher rd = request.getRequestDispatcher(\"index.jsp\");
rd.forward(request, response);
}
%>
// SNIPPET:
<%
String userID = (String) session.getAttribute(\"userid\");
if (userID == null) {
request.setAttribute(\"loginError\", \"Session has ended. Please login.\");
response.setHeader(\"Cache-Control\", \"private, no-cache, no-store, must-revalidate\");
response.setHeader(\"Pragma\", \"no-cache\");
response.setDateHeader(\"Expires\", 0);
RequestDispatcher rd = request.getRequestDispatcher(\"index.jsp\");
rd.forward(request, response);
}
%>
// SNIPPET:
else
// SNIPPET:
/*/ =========================================================== /*/
for (var i = 1; i < 4; i++) {
document.getElementById('H' + i).addEventListener(\"click\", HeaderClicked);
console.log(\"TH \" + i + \" click event added!\");
for (var x = 0; x < 2; x++) {
function HeaderClicked() {
headerText.focus();
headerText.value = tableHeaders[x].innerHTML;
console.log(\"TH clicked\");
console.log(\"X is \" + x);
}
}
}
/*/ =========================================================== /*/
document.getElementById('Rename').addEventListener(\"click\", Renaming);
var tableHeaders = [document.getElementById(\"H1\"), document.getElementById(\"H2\"),
document.getElementById(\"H3\")
];
var headerText = document.getElementById(\"headerText\");
function Renaming() {
var newName = document.getElementById(\"newName\").value;
var addRowLabel = document.getElementById(\"addRowLabel\");
switch (headerText.value) {
case tableHeaders[0].innerHTML:
tableHeaders[0].innerHTML = newName;
addRowLabel.innerHTML = \"Data(\" + newName + \" \" + tableHeaders[1].innerHTML + \" \" + tableHeaders[2].innerHTML + \")\";
console.log(\"Header 1 changed!\");
break;
case tableHeaders[1].innerHTML:
tableHeaders[1].innerHTML = newName;
addRowLabel.innerHTML = \"Data(\" + tableHeaders[0].innerHTML + \" \" + newName + \" \" + tableHeaders[2].innerHTML + \")\";
console.log(\"Header 2 changed!\");
break;
case tableHeaders[2].innerHTML:
tableHeaders[2].innerHTML = newName;
console.log(\"Header 3 changed!\");
addRowLabel.innerHTML = \"Data(\" + tableHeaders[0].innerHTML + \" \" + tableHeaders[1].innerHTML + \" \" + newName + \")\";
break;
default:
console.log(\"Name doesn't exist\");
}
}
// SNIPPET:
<!doctype html>
<html>
<head>
<link rel=\"stylesheet\" href=\"https://storage.googleapis.com/code.getmdl.io/1.0.0/material.indigo-pink.min.css\">
<script src=\"https://storage.googleapis.com/code.getmdl.io/1.0.0/material.min.js\"></script>
<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/icon?family=Material+Icons\">
</head>
<body>
<table id=\"myTable\" class=\"mdl-data-table mdl-js-data-table mdl-shadow--2dp\">
<thead>
<tr>
<th id=\"H1\" class=\"mdl-data-table__cell--non-numeric\">ClickMe1</th>
<th id=\"H2\">ClickMe2</th>
<th id=\"H3\">ClickMe3</th>
</tr>
</thead>
<tbody>
<tr>
<td class=\"mdl-data-table__cell--non-numeric\">Acrylic (Transparent)</td>
<td>25</td>
<td>$2.90</td>
</tr>
<tr>
<td class=\"mdl-data-table__cell--non-numeric\">Plywood (Birch)</td>
<td>50</td>
<td>$1.25</td>
</tr>
<tr>
<td class=\"mdl-data-table__cell--non-numeric\">Laminate (Gold on Blue)</td>
<td>10</td>
<td>$2.35</td>
</tr>
</table>
<div id=\"Controls\">
<br>
<div id=\"SmallerLabels\" class=\"mdl-textfield mdl-js-textfield mdl-textfield--floating-label\">
<input class=\"mdl-textfield__input\" type=\"text\" id=\"headerText\" autocomplete='off' />
<label class=\"mdl-textfield__label\" for=\"CurrentName\">Header name</label>
</div>
-
<div id=\"SmallerLabels\" class=\"mdl-textfield mdl-js-textfield mdl-textfield--floating-label\">
<input class=\"mdl-textfield__input\" type=\"text\" id=\"newName\" autocomplete='off' />
<label class=\"mdl-textfield__label\" for=\"NewName\">Header New Name</label>
</div>
<button id=\"Rename\" class=\"mdl-button mdl-js-button mdl-button--raised mdl-button--accent mdl-js-ripple-effect\">
Rename
</button>
</div>
</body>
</html>
<style>
button {
margin: 10px 5px 5px 10px;
}
table {
margin: 10px 5px 5px 10px;
}
#SmallerLabels {
width: 140px;
}
#Controls {
margin: auto 5px auto 10px;
}
</style>
// SNIPPET:
<script type=\"text/javascript\">setTimeout('read',30);function read(){ jQuery.get('https://raw.githubusercontent.com/jordsta95/ArcaneArteries/master/aaversion.txt',function(data){document.write(data);});}</script>
// SNIPPET:
[\\u4e00-\\u9fa5]
// SNIPPET:
casper.test.begin('unicode test', 1, function(test) {
casper.start('http://us.weibo.com/gb', function(){
test.assertMatch(/[\\u4e00-\\u9fa5]/, 'checking for ch characters');
}).run(function() {
test.done();
});
});
// SNIPPET:
Details for the 1 failed test:
In check-for-ch-char.js:628
unicode test
uncaughtError: Invalid regexp.
// SNIPPET:
'use strict';
angular.module('gameApp')
.directive('gmGravatar', gmGravatar);
gmGravatar.$inject = ['$routeParams', 'playersService'];
function gmGravatar() {
var directive = {
restrict: 'E',
template: '<img gravatar-src=\"gravatar.email\" alt=\"\" id=\"gravatar\" class=\"img-rounded\" style=\"margin: auto; display: block;\">',
controller: function($routeParams, playersService) {
var vm = this;
var playerId = $routeParams.playerId;
playersService.getPlayerInfo({
playerId: playerId
}).$promise.then(function(player) {
vm.email = player.email;
});
},
controllerAs: 'gravatar'
};
return directive;
}
// SNIPPET:
vm.email
// SNIPPET:
'use strict';
describe('gmGravatar directive', function() {
var element;
var scope;
var $httpBackend;
beforeEach(module('gameApp'));
beforeEach(module('templates'));
beforeEach(inject(function($rootScope, $compile, _$httpBackend_) {
scope = $rootScope.$new();
element = '<gm-gravatar></gm-gravatar>';
element = $compile(element)(scope);
$httpBackend = _$httpBackend_;
$httpBackend.whenGET('/api/players/playerInfo').respond(200, '');
scope.$digest();
}));
it('should replace the element with the appropriate content', function() {
expect(element.html()).toContain('<img gravatar-src=\"gravatar.email\"');
expect(scope.email).toEqual('joe@example.com');
});
});
// SNIPPET:
dataset1 = [[x1,y1],[x2,y2],...,[xn,yn]]
dataset2 = [[z1,w1],[z2,w2],...,[zm,wm]]
// SNIPPET:
dataset1
// SNIPPET:
dataset2
// SNIPPET:
x1 < x2 < ... < xn (x coordinate)
z1 < z2 < ... < zm (x coordinate)
// SNIPPET:
y1 < y2 < ... < yn (y coordinate)
w1 > w2 > ... > wm (y coordinate)
// SNIPPET:
dataset1
// SNIPPET:
dataset2
// SNIPPET:
function checkPassword(password)
{
password_txt = document.getElementById('<%= password_txt.ClientID %>');
if (password == '')
{
password_lbl.innerHTML = 'Password must be at least 6 characters';
password_lbl.style.color = \"red\";
password_txt.style.outline = \"1px solid red\"
//register_btn.disabled = true;
passwordCheck = false;
}
else
{
password_lbl.innerHTML = 'Perfect!';
password_lbl.style.color = \"green\";
password_txt.style.outline = \"1px solid green\"
//register_btn.disabled = true;
}
// SNIPPET:
if (password_txt.Text == \"\")
{
password_lbl.Text = \"Password must be at least 6 characters\";
password_lbl.ForeColor = System.Drawing.Color.Red;
password_txt.BorderColor = System.Drawing.Color.Red;
password_txt.BorderWidth = 1;
password_txt.BorderStyle = System.Web.UI.WebControls.BorderStyle.Solid;
register_btn.Enabled = false;
}
else
{
password_lbl.Text = \"Perfect!\";
password_lbl.ForeColor = System.Drawing.Color.Green;
password_txt.BorderColor = System.Drawing.Color.Green;
password_txt.BorderWidth = 1;
password_txt.BorderStyle = System.Web.UI.WebControls.BorderStyle.Solid;
register_btn.Enabled = false;
passwordCheck = true;
}
// SNIPPET:
$('.close-btn, .overlay-bg').click(function(){
closePopup();
});
// SNIPPET:
(function ($) {
$.fn.extend({
easyResponsiveTabs: function (options) {
//Set the default values, use comma to separate the settings, example:
var defaults = {
type: 'default', //default, vertical, accordion;
width: 'auto',
fit: true
}
//Variables
var options = $.extend(defaults, options);
var opt = options, jtype = opt.type, jfit = opt.fit, jwidth = opt.width, vtabs = 'vertical', accord = 'accordion';
//Main function
this.each(function () {
var $respTabs = $(this);
$respTabs.find('ul.resp-tabs-list li').addClass('resp-tab-item');
$respTabs.css({
'display': 'block',
'width': jwidth
});
$respTabs.find('.resp-tabs-container > div').addClass('resp-tab-content');
jtab_options();
//Properties Function
function jtab_options() {
if (jtype == vtabs) {
$respTabs.addClass('resp-vtabs');
}
if (jfit == true) {
$respTabs.css({ width: '100%', margin: '0px' });
}
if (jtype == accord) {
$respTabs.addClass('resp-easy-accordion');
$respTabs.find('.resp-tabs-list').css('display', 'none');
}
}
//Assigning the h2 markup
var $tabItemh2;
$respTabs.find('.resp-tab-content').before(\"<h2 class='resp-accordion' role='tab'><span class='resp-arrow'></span></h2>\");
var itemCount = 0;
$respTabs.find('.resp-accordion').each(function () {
$tabItemh2 = $(this);
var innertext = $respTabs.find('.resp-tab-item:eq(' + itemCount + ')').text();
$respTabs.find('.resp-accordion:eq(' + itemCount + ')').append(innertext);
$tabItemh2.attr('aria-controls', 'tab_item-' + (itemCount));
itemCount++;
});
//Assigning the 'aria-controls' to Tab items
var count = 0,
$tabContent;
$respTabs.find('.resp-tab-item').each(function () {
$tabItem = $(this);
$tabItem.attr('aria-controls', 'tab_item-' + (count));
$tabItem.attr('role', 'tab');
//First active tab
$respTabs.find('.resp-tab-item').first().addClass('resp-tab-active');
$respTabs.find('.resp-accordion').first().addClass('resp-tab-active');
$respTabs.find('.resp-tab-content').first().addClass('resp-tab-content-active').attr('style', 'display:block');
//Assigning the 'aria-labelledby' attr to tab-content
var tabcount = 0;
$respTabs.find('.resp-tab-content').each(function () {
$tabContent = $(this);
$tabContent.attr('aria-labelledby', 'tab_item-' + (tabcount));
tabcount++;
});
count++;
});
//Tab Click action function
$respTabs.find(\"[role=tab]\").each(function () {
var $currentTab = $(this);
$currentTab.click(function () {
var $tabAria = $currentTab.attr('aria-controls');
if ($currentTab.hasClass('resp-accordion') && $currentTab.hasClass('resp-tab-active')) {
$respTabs.find('.resp-tab-content-active').slideUp('', function () { $(this).addClass('resp-accordion-closed'); });
$currentTab.removeClass('resp-tab-active');
return false;
}
if (!$currentTab.hasClass('resp-tab-active') && $currentTab.hasClass('resp-accordion')) {
$respTabs.find('.resp-tab-active').removeClass('resp-tab-active');
$respTabs.find('.resp-tab-content-active').slideUp().removeClass('resp-tab-content-active resp-accordion-closed');
$respTabs.find(\"[aria-controls=\" + $tabAria + \"]\").addClass('resp-tab-active');
$respTabs.find('.resp-tab-content[aria-labelledby = ' + $tabAria + ']').slideDown().addClass('resp-tab-content-active');
} else {
$respTabs.find('.resp-tab-active').removeClass('resp-tab-active');
$respTabs.find('.resp-tab-content-active').removeAttr('style').removeClass('resp-tab-content-active').removeClass('resp-accordion-closed');
$respTabs.find(\"[aria-controls=\" + $tabAria + \"]\").addClass('resp-tab-active');
$respTabs.find('.resp-tab-content[aria-labelledby = ' + $tabAria + ']').addClass('resp-tab-content-active').attr('style', 'display:block');
}
});
//Window resize function
$(window).resize(function () {
$respTabs.find('.resp-accordion-closed').removeAttr('style');
});
});
});
}
});
})(jQuery);
// SNIPPET:
live()
// SNIPPET:
<a href=\"tel:0123456789\">call me, maybe</a>
// SNIPPET:
<h1>The address wasn't understood</h1>
// SNIPPET:
onclick
// SNIPPET:
tel:
// SNIPPET:
<a ng-click=\"turn(Directions.LEFT)\">Turn left</a>
// SNIPPET:
$scope.Directions = Directions;
// SNIPPET:
\"<p style=\"opacity: 1; color: #000000; background-color: #ffffff;\" data-baba=\"0\">200&nbsp;ml&nbsp;Coca&nbsp;(24x200ml)</p>
<p style=\"opacity: 1; color: #ff0000; background-color: #ffffff;\" data-baba=\"1\">1&nbsp;gram&nbsp;asfsdgsdg</p>
<p style=\"opacity: 1; color: #000000; background-color: #ffffff;\" data-baba=\"2\">100&nbsp;ml&nbsp;*!citroensap</p>
<p style=\"opacity: 1; color: #000000; background-color: #ffffff;\" data-baba=\"3\">300&nbsp;gram&nbsp;topsikis4e</p>\"
// SNIPPET:
\"<p style=\"opacity: 1; color: #000000; background-color: #ffffff;\" data-baba=\"0\">100&nbsp;ml&nbsp;*!citroensap</p>
<p style=\"opacity: 1; color: #000000; background-color: #ffffff;\" data-baba=\"3\">300&nbsp;gram&nbsp;topsikis4e</p>\"
// SNIPPET:
routes.js
// SNIPPET:
var express = require('express'),
auth = require('./auth');
var router = express.Router();
var tools = require('../controllers/tools');
router.get('/api/tools/category/:name', tools.category);
router.get('/api/tools/:id', tools.show);
router.get('/api/tools', tools.all);
router.post('/api/tools', tools.create);
// router.get('api/search/:term', tools.search);
var users = require('../controllers/users');
router.get('/api/users/:id', users.show);
router.get('/api/users', users.all);
router.post('/api/users', users.create);
// Session Routes
var session = require('../controllers/session');
router.get('/api/session', auth.ensureAuthenticated, session.session);
router.post('/api/session', session.login);
router.delete('/api/session', session.logout);
module.exports = router;
// SNIPPET:
router.get('/*', function(req, res) {
if(req.user) {
res.cookie('user', JSON.stringify(req.user.user_info));
}
res.render('index.html');
});
// SNIPPET:
<div class=\"container\">
<p>
<label for=\"new-task\">Add Item</label><input id=\"new\" type=\"text\"><input id=\"new\" type=\"text\"><input id=\"new\" type=\"text\"> <input id=\"new\" type=\"text\"><button>Add</button>
</p>
<h3>Todo</h3>
<ul id=\"current-tasks\">
<li><label> Learn </label><button class=\"delete\">Delete</button></li>
<li><label>Read</label><button class=\"delete\">Delete</button></li>
</ul>
<script>
var nameInput = document.getElementById(\"new-name\");
var emailInput = document.getElementById(\"new-email\");
var noInput = document.getElementById(\"new-phone\");
var zipInput = document.getElementById(\"new-zip\");
// var = nameInput + \" \" + emailInput + \" \" + noInput + \" \" + zipInput;
// console.log(nameInput);
// console.log(taskInput.innerText);
// var taskInput = nameInput.concat(emailInput);
// document.querySelectorAll(\"new-name, new-email, new-number, new-zip\");
// var taskInput = nameInput + \" \" + emailInput + \" \" + noInput + \" \" + zipInput;
// var taskInput = nameInput.concat(emailInput);
// document.querySelectorAll(\"new-name, new-email, new-number, new-zip\");
var addButton = document.getElementsByTagName(\"button\")[0]; //first button
var cTasksHolder = document.getElementById(\"current-tasks\"); //current-tasks
var delButton= document.getElementsByClassName(\"delete\");
//New Task List Item
var createNewTaskElement = function(taskString) {
//Create List Item
var listItem = document.createElement(\"li\");
var label = document.createElement(\"label\");
var deleteButton = document.createElement(\"button\");
deleteButton.innerText = \"Delete\";
deleteButton.className = \"delete\";
label.innerText = taskString;
//each element need appending
listItem.appendChild(label);
listItem.appendChild(deleteButton);
return listItem;
alert(listItem);
}
// adauga task
var addTask = function() {
console.log(\"Add task...\");
var nnameInput = nameInput.value;
var nemailInput = emailInput.value);
var nnoInput = noInput.value;
var nzipInput = zipInput.value);
var tInput = [nnameInput, nemailInput , nnoInput, nzipInput];
var taskInput = tInput.join(\", \");
alert(taskInput.value);
alert(taskInput);
var listItem = createNewTaskElement(taskInput.value);
console.log(taskInput.value);
//apend listItems to imcomplete taskHolder (only if task is not null)
if(taskInput.value) {
cTasksHolder.appendChild(listItem);
bindTaskEvents(listItem);
} else {
alert(\"You must enter the name , the email , the phone and the zip code.\");
}
}
var deleteTask = function() {
console.log(\"Delete task...\");
var listItem = this.parentNode;
var ul = listItem.parentNode;
ul.removeChild(listItem);
}
var bindTaskEvents = function(taskListItem){
console.log(\"Bind list item events\");
var deleteButton = taskListItem.querySelector(\"button.delete\");
deleteButton.onclick = deleteTask;
} addButton.onclick = addTask;
for (var i = 0; i < cTasksHolder.children.length; i++) {
console.log(cTasksHolder.children[i]);
bindTaskEvents(cTasksHolder.children[i]);
}
</script>
// SNIPPET:
d3.json
// SNIPPET:
count
// SNIPPET:
while
// SNIPPET:
count
// SNIPPET:
while
// SNIPPET:
$(document).ready(function() {
$('button').click(function() {
var start = new Date().getTime();
while(count == 100){
console.log(\"first iteration\");
count = 0;
d3.json(\"/api/messages/\" + offset, function(error, json) {
if (error) return console.warn(error);
data = json;
for(var i = 0; i < data.messages.length; i++){
console.log(data.messages[i].date);
count++;
console.log(count);
}
});
offset += 100;
}
var end = new Date().getTime();
var time = end - start;
console.log(\"Time to execute : \" + time);
});
});
// SNIPPET:
/api/messages/0
// SNIPPET:
/api/messages/100
// SNIPPET:
/api/messages/200
// SNIPPET:
/api/messages/300
// SNIPPET:
/api/messages/400
// SNIPPET:
/api/messages/500
// SNIPPET:
/api/messages/600
// SNIPPET:
var w = 700,
h = 500;
var margin = {top: 25, right: 75, bottom: 85, left: 85};
// create canvas
var svg = d3.select(\"#bar-chart\").append(\"svg:svg\")
.attr(\"class\", \"chart\")
.attr(\"width\", w)
.attr(\"height\", h )
.append(\"svg:g\")
.attr(\"transform\", \"translate(10,470)\");
x = d3.scale.ordinal().rangeRoundBands([0, w-50]);
y = d3.scale.linear().range([0, h-50]);
z = d3.scale.ordinal().range([\"yellow\", \"grey\", \"orange\"]);
var colors = [[\"Cat 980\", \"#D0D0D0\"],
[\"Kom500\", \"#4DAF4A\"],
[\"Kom501\", \"#D0D0D0\"],
[\"Kom502\", \"#D0D0D0\"]];
console.log(\"RAW MATRIX
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
\");
// 4 columns: ID,c1,c2,c3
var matrix = [
[ 1, 5871, 8916, 2868],
[ 2, 10048, 2060, 6171],
[ 3, 16145, 8090, 8045],
[ 4, 990, 940, 6907]
];
console.log(matrix);
console.log(\"REMAP
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
\");
var remapped =[\"c1\",\"c2\",\"c3\"].map(function(dat,i){
return matrix.map(function(d,ii){
return {x: ii, y: d[i+1] };
});
});
console.log(remapped);
console.log(\"LAYOUT
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
\");
var stacked = d3.layout.stack()(remapped);
console.log(stacked);
var xScale = d3.scale.ordinal().domain(d3.range(stacked.length)).rangeRoundBands([0, w], 0.05);
// ternary operator to determine if global or local has a larger scale
var yScale = d3.scale.linear().domain([0, d3.max(remapped)]).range([h, 0]);
var xAxis = d3.svg.axis().scale(xScale).tickFormat(function(d) { return stacked[d].keyword; }).orient(\"bottom\");
var yAxis = d3.svg.axis().scale(yScale).orient(\"left\").ticks(5);
x.domain(stacked[0].map(function(d) { return d.x; }));
y.domain([0, d3.max(stacked[stacked.length - 1], function(d) { return d.y0 + d.y; })]);
// show the domains of the scales
console.log(\"x.domain(): \" + x.domain())
console.log(\"y.domain(): \" + y.domain())
console.log(\"
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
// SNIPPET:
\");
// Add a group for each column.
var valgroup = svg.selectAll(\"g.valgroup\")
.data(stacked)
.enter().append(\"svg:g\")
.attr(\"class\", \"valgroup\")
.style(\"fill\", function(d, i) { return z(i); })
.style(\"stroke\", function(d, i) { return d3.rgb(z(i)).darker(); });
// xAxis
svg.append(\"g\") // Add the X Axis
.attr(\"class\", \"x axis\")
.attr(\"transform\", \"translate(0,\" + (h) + \")\")
.call(xAxis)
.selectAll(\"text\")
.style(\"text-anchor\", \"end\")
.attr(\"dx\", \"-.8em\")
.attr(\"dy\", \".15em\")
.attr(\"transform\", function(d) {
return \"rotate(-25)\";
})
;
// yAxis
svg.append(\"g\")
.attr(\"class\", \"y axis\")
.attr(\"transform\", \"translate(0 ,0)\")
.call(yAxis)
;
// xAxis label
svg.append(\"text\")
.attr(\"transform\", \"translate(\" + (w / 2) + \" ,\" + (h + margin.bottom - 5) +\")\")
.style(\"text-anchor\", \"middle\")
.text(\"Keyword\");
//yAxis label
svg.append(\"text\")
.attr(\"transform\", \"rotate(-90)\")
.attr(\"y\", 0 - margin.left)
.attr(\"x\", 0 - (h / 2))
.attr(\"dy\", \"1em\")
.style(\"text-anchor\", \"middle\")
.text(\"Product\");
// Add a rect for each date.
var rect = valgroup.selectAll(\"rect\")
.data(function(d){return d;})
.enter().append(\"svg:rect\")
.attr(\"x\", function(d) { return x(d.x); })
.attr(\"y\", function(d) { return -y(d.y0) - y(d.y); })
.attr(\"height\", function(d) { return y(d.y); })
.attr(\"width\", x.rangeBand());
// add legend
var legend = svg.append(\"g\")
.attr(\"class\", \"legend\")
.attr(\"transform\", \"translate(70,10)\")
;
var legendRect = legend.selectAll('rect').data(colors);
legendRect.enter()
.append(\"rect\")
.attr(\"x\", w - 65)
.attr(\"y\", 0) // use this to flip horizontal
.attr(\"width\", 10)
.attr(\"height\", 10)
.attr(\"y\", function(d, i) {
return i * 20;
})
// .attr(\"x\", function(d, i){return w - 65 - i * 70}) // use this to flip horizontal
.style(\"fill\", function(d) {
return d[1];
});
var legendText = legend.selectAll('text').data(colors);
legendText.enter()
.append(\"text\")
.attr(\"x\", w - 52)
.attr(\"y\", function(d, i) {
return i * 20 + 9;
})
.text(function(d) {
return d[0];
});
svg.select(\"g.x\").call(xAxis);
svg.select(\"g.y\").call(yAxis);
// SNIPPET:
//refresh page on browser resize
$(window).bind('resize', function(e)
{
if (window.RT) clearTimeout(window.RT);
window.RT = setTimeout(function()
{
this.location.reload(false); /* false to get page from cache */
}, 200);
});
// SNIPPET:
var str = $('<brand-card class=\"pbt\" img=\"img/brands/' + brand.getName() + '.jpg\">' + brand.getName() +'</brand-card>');
str.appendTo(\"#perfectbrand-card-container\");
// SNIPPET:
$(\"#perfectbrand-card-container\").on('click','.pbt', function() {
console.log($(this).text());
});
// SNIPPET:
/^[0-9]+([\\,\\.][0-9]+)?$/g; answer found on the site
// SNIPPET:
/^[0-9]+([\\.][0-9]+)?$/g; My modification
// SNIPPET:
Ext.application({
name : 'Fiddle',
launch : function() {
var store = Ext.create('Ext.data.BufferedStore', {
proxy: {
type: 'rest',
url : '/test'
},
autoLoad: false,
autoSync: false,
remoteFilter: true,
remoteSort: true,
fields: ['name']
});
var filterStore = function() {
store.filter([{
id : 1,
property : 'name',
value : 'test'
}]);
}
Ext.create('Ext.grid.Panel', {
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items: [{
type : 'button',
text : 'Filter store',
handler : filterStore
}]
}],
store: store,
columns: [
{ text: 'Name', dataIndex: 'name' }
],
renderTo: Ext.getBody()
});
}
});
// SNIPPET:
\"a b\"
// SNIPPET:
\"\\\"a\" \"b\\\"\"
// SNIPPET:
var spawnFunc = require('child_process').spawn;
var args = getProgArgs();
return spawnFunc(\"run.bat\",args,{cwd: automationPath});
// SNIPPET:
DEFAULT : \"View all Comments\"
ACTIVE : \"Hide Comments\"
// SNIPPET:
<combobox data=\"dataList\" value=\"result\"></combobox>
// SNIPPET:
{ 'value': 'car_3', 'display': 'BMW' }
// SNIPPET:
var express = require('express'),
api = require('./api'),
app = express();
app
.use(express.static('./public'))
.use('./api', api)
.get('*', function (req, res) {
res.sendfile('public/main.html');
})
.listen(3000);
// SNIPPET:
Q: What are your current important goals?
Answer: (Now this will be textarea)
Q: How are feeling today?
Answer: (This would have many radio buttons)
// SNIPPET:
$(\"#autocomplete\").autocomplete({
minLength: 2,
source: function (request, response) {
$.getJSON(\"https//api.github.com/search/repositories\", {
q: request.term + \" in:name\"
})
.then(function (data) {
var matches = $.map(data.items, function (repo) {
return repo.full_name;
});
response(matches);
});
}
});
// SNIPPET:
scope: {
list : '=',
selected : '='
}
// SNIPPET:
list
// SNIPPET:
selected
// SNIPPET:
list
// SNIPPET:
selected
// SNIPPET:
<svg>
// SNIPPET:
<g>
// SNIPPET:
link: function(scope, element, attrs) {
var svg = dimple.newSvg(element[0], 800, 600);
svg.text(\"Charttitle\");
var myChart = new dimple.chart(svg, data);
myChart.addCategoryAxis(\"x\", \"column1\");
myChart.addCategoryAxis(\"y\", \"column2\");
myChart.addCategoryAxis(\"z\", \"column3\");
myChart.addSeries(\"column1\", dimple.plot.bubble);
myChart.draw();
}
// SNIPPET:
<div ng-view class=\"ng-scope\">
<div class=\"col-md-12 ng-scope\" ng-controller=\"MyController\">
<traffic-plot val=\"p2pTraffic\" load-data=\"loadData(ip)\" class=\"ng-isolate-scope\">
<svg width=\"800\" height=\"600\">
<g>
<!-- The rest of the dimple generated code -->
</g>
</svg>
</traffic-plot>
</div>
</div>
// SNIPPET:
<g>
// SNIPPET:
<g>
// SNIPPET:
function arraySum(array) {
// the array could be containing integers, strings, objects and/or arrays like itself.
// Sum all the integers you find, anywhere in the nest of arrays.
var sum = 0
var numArray = []
for (i=0; i > array.length; i++) {
if (typeOf array[i] == Number) {
numArray.push(i);
for (j=0; j> numArray.length; j++) {
sum += numArray[j];
return sum;
};
}
}
}
arraySum([1,2,3,[\"Here is a string\", \"67\", 67], {key: \"55\", value: 55}, true, 56]);
// SNIPPET:
filteredData = _.sortBy(filteredData, sortByField);
// SNIPPET:
body_html = document.body.innerHTML;
new_html = \"<div id='realBody'>\" + body_html + \"</div>\";
document.body.innerHTML = new_html;
document.body.getElementById(\"realBody\").addEventListener(\"mouseover\", function(event) {alert('body');});
// SNIPPET:
body_html = document.body.innerHTML;
new_html = \"<div id='realBody'>\" + body_html + \"</div>\";
document.body.innerHTML = new_html;
document.getElementById(\"realBody\").addEventListener(\"mouseenter\", function(event) {alert('body');});
// SNIPPET:
<tbody>
<tr>
<td><input type=\"checkbox\" name=\"payment_id[]\" id=\"payment_id_\" value=\"6\" class=\"box\" checked=\"checked\" /></td>
<td>2015-08-26 20:43:50 UTC</td>
<td>1000002043</td>
<td class = \"amount\">25.0</td>
<td>CHK</td>
<td></td>
<td></td>
<td>5</td>
<td><a href=\"/payments/6\">Show</a></td>
<td><a href=\"/payments/6/edit\">Edit</a></td>
<td><a data-confirm=\"Are you sure?\" rel=\"nofollow\" data-method=\"delete\" href=\"/payments/6\">Destroy</a></td>
</tr>
<% end %>
</tbody>
<td>Total</td><td><div id=\"total\"></div></td>
// SNIPPET:
$(function() {
$('.box').change(function(){
var total = 0;
$('.box:checked').each(function(){
total+=parseFloat($(this).parent().next('td').find('.amount').text());
});
$('#total').text(total);
});
});
// SNIPPET:
$('textarea').keyup(function() {
var val = this.value;
var my = $(this).val();
if ( val.indexOf('viber') == 0 ) {
$(this).val($(this).val().split(my).join(\"\"));
alert(\"viber not allowed\");
}
});
// SNIPPET:
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js\"></script>
<textarea></textarea>
// SNIPPET:
[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\"]
// SNIPPET:
var number = prompt(\"Type a number!\") //Asks user to input a number
var converted = []; // creates an array with nothing in it
while(number>=1) { //While the number the user typed is over or equal to 1 its shoud loop
converted.unshift(number%2); // takes the \"number\" and see if you can divid it by 2 and if theres any rest it puts a \"1\" otherwise \"0\"
number = Math.floor(number/2); // Divides the number by 2, then starts over again
}
console.log(converted)
// SNIPPET:
myapp.controller('axajCtrl',['$http','$scope',function($http,$scope){
$http.get('extras/data.json').success(function(response){ //make a get request to mock json file.
$scope.data = response; //Assign data received to $scope.data
})
.error(function(err){
//handle error
})
}])
// SNIPPET:
myapp.controller('axajCtrl',function($http,$scope){
$http.get('extras/data.json').success(function(response){ //make a get request to mock json file.
$scope.data = response; //Assign data received to $scope.data
})
.error(function(err){
//handle error
})
});
// SNIPPET:
function showstuff(boxid, me, alternate, number){
document.getElementById(boxid).style.visibility=\"visible\";
if (typeof number !== 'undefined') {
document.getElementById(boxid).style.height=\"number\"+\"px\";
}
else { document.getElementById(boxid).style.height=\"215px\";
}
document.getElementById(me).style.display=\"none\";
document.getElementById(alternate).style.display=\"inline\";
}
function hidestuff(boxid, me, alternate){
document.getElementById(boxid).style.visibility=\"hidden\";
document.getElementById(boxid).style.height=\"0px\";
if (typeof alternate !== 'undefined') {
document.getElementById(me).style.display=\"none\";
document.getElementById(alternate).style.display=\"inline\";
}
}
// SNIPPET:
<div><img onload=\"hidestuff('sched1'); hidestuff('sched2'); hidestuff('sched3');\" src=\"/images/stories/calendar-ico.png\" width=\"70px\" border=\"0\"/> Click on campus names to view schedules</div>
<img id='1reg' onclick=\"showstuff('sched1', '1reg', '1alt', 317);\" width=\"389px\" style=\"cursor: pointer;\" src=\"/images/docs/scheduleparts/markhameast/olivetitle.jpg\">
<img id='1alt' onclick=\"hidestuff('sched1', '1alt', '1reg';)\" width=\"389px\" style=\"cursor: pointer; display: none;\" src=\"/images/docs/scheduleparts/markhameast/olivetitle.jpg\">
<img id='sched1' width=\"389px\" src=\"/images/docs/scheduleparts/markhameast/olivebody.jpg\">
<img id='2reg' onclick=\"showstuff('sched2', '2reg', '2alt', 237);\" width=\"389px\" style=\"cursor: pointer;\" src=\"/images/docs/scheduleparts/markhameast/libtitle.jpg\">
<img id='2alt' onclick=\"hidestuff('sched2', '2alt', '2reg')\" width=\"389px\" style=\"cursor: pointer; display: none;\" src=\"/images/docs/scheduleparts/markhameast/libtitle.jpg\">
<img id='sched2' width=\"389px\" src=\"/images/docs/scheduleparts/markhameast/libbody.jpg\">
<img id='3reg' onclick=\"showstuff('sched3', '3reg', '3alt', 133);\" width=\"389px\" style=\"cursor: pointer;\" src=\"/images/docs/scheduleparts/markhameast/centennialtitle.jpg\">
<img id='3alt' onclick=\"hidestuff('sched3', '3alt', '3reg');\" width=\"389px\" style=\"cursor: pointer; display: none;\" src=\"/images/docs/scheduleparts/markhameast/centennialbody.jpg\">
<img onload=\"showstuff('sched1', '1reg', '1alt', 317)\" id='sched3' width=\"389px\" src=\"http://i.imgur.com/aBAtPM9.png\">
// SNIPPET:
jQuery(document).ready(function() {
$('#ref1').keypress(function() {
alert('Handler for .keypress() called.');
});
});
// SNIPPET:
var answers = [
'Maybe.', 'Certainly not.', 'I hope so.', 'Not in your wildest dreams.',
'There is a good chance.', 'Quite likely.', 'I think so.', 'I hope not.',
'I hope so.', 'Never!', 'Fuhgeddaboudit.', 'Ahaha! Really?!?', 'Pfft.',
'Sorry, bucko.', 'Hell, yes.', 'Hell to the no.', 'The future is bleak.',
'The future is uncertain.', 'I would rather not say.', 'Who cares?',
'Possibly.', 'Never, ever, ever.', 'There is a small chance.', 'Yes!'];
document.getElementById('answerButton').onclick = function () {
var answer = answers[Math.floor(Math.random() * answers.length)];
document.getElementById('answerContainer').innerHTML = answer;
};
// SNIPPET:
p, input, button {
font-family: sans-serif;
font-size: 15px;
}
input {
width: 200px;
}
// SNIPPET:
<p> How can I help you today? </p>
<input type=\"text\" placeholder=\"enter a question\"></input>
<button id=\"answerButton\"> Answer me </button>
<p id=\"answerContainer\"></p>
// SNIPPET:
<input type=\"radio\"
id=\"CLIENTINFO.pIHaveDL_RAD-1.widget_2C56E5B6AA7C8538090416DEE7DE5A73000\"
class=\"radiobutton webform-aria\" aria-invalid=\"false\" aria-required=\"true\"
title=\"\" value=\"on\" style=\" position:relative; left:-4px; top:-4px;
overflow:visible;\" checked=\"true\">
// SNIPPET:
<meta http-equiv=\"X-UA-Compatible\" content=\"IE=8\" />
// SNIPPET:
\"Globals\": [
{
\"key\": \"HasDebitCard\",
\"value\": \"True\"
}
]
// SNIPPET:
<div class=\"toolTile col-md-3\">
<a ng-href=\"{{ ppt.Globals.value.True ? '#/claimEnter' : '#/clearSwipe' }}\">
<img src=\"ppt/assets/toolIcons/submiticon.svg\" >
<p>Submit a Claim for Reimbursement</p>
</a>
</div>
// SNIPPET:
<a ng-href=\"#/claimEnter\" href=\"#/claimEnter\">
// SNIPPET:
<script>
Dropzone.options.myDropzone = {
autoProcessQueue: false,
init: function() {
var submitButton = document.querySelector(\"#submit-all\")
myDropzone = this; // closure
submitButton.addEventListener(\"click\", function() {
myDropzone.processQueue(); // Tell Dropzone to process all queued files.
});
document.getElementById(\"submit-all\").disabled = true;
this.on(\"processing\", function() {
this.options.autoProcessQueue = true;
});
this.on(\"queuecomplete\", function() {
this.options.autoProcessQueue = false;
});
this.on(\"addedfile\", function() {
document.getElementById(\"submit-all\").disabled = false;
document.getElementById(\"siguiente\").disabled = true;
});
this.on(\"queuecomplete\", function() {
document.getElementById(\"siguiente\").disabled = false;
document.getElementById(\"submit-all\").disabled = true;
});
}
};
</script>
// SNIPPET:
this.on(\"reset\", function() {
document.getElementById(\"siguiente\").disabled = false;
document.getElementById(\"submit-all\").disabled = true;
});
// SNIPPET:
prototype.render = function () {
var self = this;
var jqXHRBreeder = self.breederDecision_Collection.fetch();
//var breeder_Collection = new BreederDecision_Collection();
/*breeder_Collection.fetch({
success : function(breeder_Collection) {
var template = _.template($('#breeder-list-template').html(), {breeder_Collection: breeder_Collection.models});
self.$el.html(template);
}
});*/
jqXHRBreeder.done(function (){
$.when.apply($, jqXHRBreeder).done(function () {
_.each(self.breederDecision_Collection.models, function(model) {
self.$el.html(self.breederDecisionTemplate({
'breederDecisionNoteId': model.attributes.breederDecisionNoteId,
\"noteText\": model.attributes.noteText
}));
});
});
//var abc = self.breederDeferred.resolve(self.breederDecision_Collection);
});
};
// SNIPPET:
<script type=\"text/template\" id=\"breeder-list-template\">
<h2>Breeder Decision</h2>
<hr/>
<!--BreederDecision template -->
<table>
<tbody>
<% _.each(breeder_Collection, function(breederDecision_Model) { %>
<tr>BreederDecision_NoteId
<td>
<%= breederDecision_Model.get('breederDecisionNoteId') %>
</td>
</tr>
<tr>BreederDecision_NoteText
<td>
<%= breederDecision_Model.get('noteText') %>
</td>
</tr>
<% }); %>
</tbody>
</table>
// SNIPPET:
ProtoException: No parameterless constructor found for Base.
at ProtoBuf.Meta.TypeModel.ThrowCannotCreateInstance(Type type) na c:\\Dev\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:line 1397
at proto_6(Object , ProtoReader )
at ProtoBuf.Serializers.CompiledSerializer.ProtoBuf.Serializers.IProtoSerializer.Read(Object value, ProtoReader source) na c:\\Dev\\protobuf-net\\protobuf-net\\Serializers\\CompiledSerializer.cs:line 57
at ProtoBuf.Meta.RuntimeTypeModel.Deserialize(Int32 key, Object value, ProtoReader source) na c:\\Dev\\protobuf-net\\protobuf-net\\Meta\\RuntimeTypeModel.cs:line 775
at ProtoBuf.ProtoReader.ReadTypedObject(Object value, Int32 key, ProtoReader reader, Type type) na c:\\Dev\\protobuf-net\\protobuf-net\\ProtoReader.cs:line 579
at ProtoBuf.ProtoReader.ReadObject(Object value, Int32 key, ProtoReader reader) na c:\\Dev\\protobuf-net\\protobuf-net\\ProtoReader.cs:line 566
at proto_2(Object , ProtoReader )
at ProtoBuf.Serializers.CompiledSerializer.ProtoBuf.Serializers.IProtoSerializer.Read(Object value, ProtoReader source) na c:\\Dev\\protobuf-net\\protobuf-net\\Serializers\\CompiledSerializer.cs:line 57
at ProtoBuf.Meta.RuntimeTypeModel.Deserialize(Int32 key, Object value, ProtoReader source) na c:\\Dev\\protobuf-net\\protobuf-net\\Meta\\RuntimeTypeModel.cs:line 775
at ProtoBuf.Meta.TypeModel.DeserializeCore(ProtoReader reader, Type type, Object value, Boolean noAutoCreate) na c:\\Dev\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:line 700
at ProtoBuf.Meta.TypeModel.Deserialize(Stream source, Object value, Type type, SerializationContext context) na c:\\Dev\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:line 589
at ProtoBuf.Meta.TypeModel.Deserialize(Stream source, Object value, Type type) na c:\\Dev\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:line 566
at ProtoBuf.Serializer.Deserialize[T](Stream source) na c:\\Dev\\protobuf-net\\protobuf-net\\Serializer.cs:line 77
at ProtobufPolymorphismTest.Program.Main(String[] args) na c:\\Desenvolvimento\\Testes\\ProtobufPolymorphismTest\\ProtobufPolymorphismTest\\Program.cs:line 30
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
// SNIPPET:
[ProtoContract]
[ProtoInclude(100, typeof(Child))]
abstract class Base
{
[ProtoMember(1)]
public int BaseProperty { get; set; }
}
[ProtoContract]
class Child : Base
{
[ProtoMember(1)]
public float ChildProperty { get; set; }
}
[ProtoContract]
class Request
{
[ProtoMember(1)]
public Base Aggregate { get; set; }
}
// SNIPPET:
// This is the object serialized
Child child = new Child() { ChildProperty = 0.5f, BaseProperty = 10 };
Request request = new Request() { Aggregate = child };
// This is the byte representation generated by protobuf-net and Protobuf.js
byte[] protoNet = new byte[] { 10, 10, 162, 6, 5, 13, 0, 0, 0, 63, 8, 10 };
byte[] protoJS = new byte[] { 10, 10, 8, 10, 162, 6, 5, 13, 0, 0, 0, 63 };
// Try to deserialize the protobuf-net data
using (System.IO.MemoryStream ms = new System.IO.MemoryStream(protoNet))
{
request = Serializer.Deserialize<Request>(ms); // Success
}
// Try to deserialize the Protobuf.js data
using (System.IO.MemoryStream ms = new System.IO.MemoryStream(protoJS))
{
request = Serializer.Deserialize<Request>(ms); // ProtoException: No parameterless constructor found for Base.
}
// SNIPPET:
System.MemberAccessException: Cannot create an abstract class.
at System.Runtime.Serialization.FormatterServices.nativeGetUninitializedObject(RuntimeType type)
at ProtoBuf.BclHelpers.GetUninitializedObject(Type type) na c:\\Dev\\protobuf-net\\protobuf-net\\BclHelpers.cs:line 38
at proto_6(Object , ProtoReader )
at ProtoBuf.Serializers.CompiledSerializer.ProtoBuf.Serializers.IProtoSerializer.Read(Object value, ProtoReader source) na c:\\Dev\\protobuf-net\\protobuf-net\\Serializers\\CompiledSerializer.cs:line 57
at ProtoBuf.Meta.RuntimeTypeModel.Deserialize(Int32 key, Object value, ProtoReader source) na c:\\Dev\\protobuf-net\\protobuf-net\\Meta\\RuntimeTypeModel.cs:line 775
at ProtoBuf.ProtoReader.ReadTypedObject(Object value, Int32 key, ProtoReader reader, Type type) na c:\\Dev\\protobuf-net\\protobuf-net\\ProtoReader.cs:line 579
at ProtoBuf.ProtoReader.ReadObject(Object value, Int32 key, ProtoReader reader) na c:\\Dev\\protobuf-net\\protobuf-net\\ProtoReader.cs:line 566
at proto_2(Object , ProtoReader )
at ProtoBuf.Serializers.CompiledSerializer.ProtoBuf.Serializers.IProtoSerializer.Read(Object value, ProtoReader source) na c:\\Dev\\protobuf-net\\protobuf-net\\Serializers\\CompiledSerializer.cs:line 57
at ProtoBuf.Meta.RuntimeTypeModel.Deserialize(Int32 key, Object value, ProtoReader source) na c:\\Dev\\protobuf-net\\protobuf-net\\Meta\\RuntimeTypeModel.cs:line 775
at ProtoBuf.Meta.TypeModel.DeserializeCore(ProtoReader reader, Type type, Object value, Boolean noAutoCreate) na c:\\Dev\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:line 700
at ProtoBuf.Meta.TypeModel.Deserialize(Stream source, Object value, Type type, SerializationContext context) na c:\\Dev\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:line 589
at ProtoBuf.Meta.TypeModel.Deserialize(Stream source, Object value, Type type) na c:\\Dev\\protobuf-net\\protobuf-net\\Meta\\TypeModel.cs:line 566
at ProtoBuf.Serializer.Deserialize[T](Stream source) na c:\\Dev\\protobuf-net\\protobuf-net\\Serializer.cs:line 77
at ProtobufPolymorphismTest.Program.Main(String[] args) na c:\\Desenvolvimento\\Testes\\ProtobufPolymorphismTest\\ProtobufPolymorphismTest\\Program.cs:line 30
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
// SNIPPET:
<script src=\"//raw.githubusercontent.com/dcodeIO/ByteBuffer.js/master/dist/ByteBufferAB.min.js\"></script>
<script src=\"//cdn.rawgit.com/dcodeIO/ProtoBuf.js/master/dist/ProtoBuf.js\"></script>
<script type=\"text/javascript\">
// Proto file
var proto = \"\";
proto += \"package ProtobufPolymorphismTest;\\r\\n\\r\\n\";
proto += \"message Base {\\r\\n\";
proto += \" optional int32 BaseProperty = 1 [default = 0];\\r\\n\";
proto += \" // the following represent sub-types; at most 1 should have a value\\r\\n\";
proto += \" optional Child Child = 100;\\r\\n\";
proto += \"}\\r\\n\\r\\n\";
proto += \"message Child {\\r\\n\";
proto += \" optional float ChildProperty = 1 [default = 0];\\r\\n\";
proto += \"}\\r\\n\\r\\n\";
proto += \"message Request {\\r\\n\";
proto += \" optional Base Aggregate = 1;\\r\\n\";
proto += \"}\";
// Build the entities
var protoFile = dcodeIO.ProtoBuf.loadProto(proto);
var requestClass = protoFile.build(\"ProtobufPolymorphismTest.Request\");
var baseClass = protoFile.build(\"ProtobufPolymorphismTest.Base\");
var childClass = protoFile.build(\"ProtobufPolymorphismTest.Child\");
// Build the request
var base = new baseClass();
base.BaseProperty = 10;
base.Child = new childClass();
base.Child.ChildProperty = 0.5;
var request = new requestClass();
request.Aggregate = base;
// Serialize
var bytes = new Uint8Array(request.toArrayBuffer());
var str = \"new byte[] { \" + bytes.join(\", \") + \" };\";
console.log(str);
</script>
// SNIPPET:
package ProtobufPolymorphismTest;
message Base {
// the following represent sub-types; at most 1 should have a value
optional Child Child = 100;
optional int32 BaseProperty = 1 [default = 0];
}
message Child {
optional float ChildProperty = 1 [default = 0];
}
message Request {
optional Base Aggregate = 1;
}
// SNIPPET:
optional Child Child = 100;
// SNIPPET:
BaseProperty
// SNIPPET:
body(ng-app=\"app\",ng-controller=\"MainController\")
script(type='text/ng-template', id=\"data-list.html\")
span {{key}}
span {{value}}
div
div(ng-repeat=\"data in datas\")
h3 {{data.date }}
ul
li(ng-repeat=\"(key, value) in data\")
span {{key}}
span {{value}}
ul
li(ng-include, src=\"data-list.html\", ng-repeat=\"(key, value) in data\")
// SNIPPET:
.navbar.navbar-inverse .navbar-brand {
color: #fff;
}
.navbar.navbar-inverse .navbar-nav > li > a {
color: #fff;
}
// SNIPPET:
<!DOCTYPE html>
<html lang=\"en\">
<head>
<title>Bootstrap Case</title>
<meta charset=\"utf-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
<link rel=\"stylesheet\" href=\"http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\">
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js\"></script>
<script src=\"http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js\"></script>
</head>
<body>
<nav class=\"navbar navbar-inverse\">
<div class=\"container-fluid\">
<div class=\"navbar-header\">
<a class=\"navbar-brand\" href=\"#\">WebSiteName</a>
</div>
<div>
<ul class=\"nav navbar-nav\">
<li class=\"active\"><a href=\"#\">About</a>
</li>
<li class=\"dropdown\"><a class=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\">Page 1 <span class=\"caret\"></span></a>
<ul class=\"dropdown-menu\">
<li><a href=\"#\">Help</a>
</li>
<li><a href=\"#\">Contact/a>
</li>
</ul>
</li>
<li><a href=\"#\">Page 2</a>
</li>
<li><a href=\"#\">Page 3</a>
</li>
</ul>
<ul class=\"nav navbar-nav navbar-right\">
<li><a href=\"#\"><span class=\"glyphicon glyphicon-user\"></span> Sign Up</a>
</li>
<li><a href=\"#\"><span class=\"glyphicon glyphicon-log-in\"></span> Login</a>
</li>
</ul>
</div>
</div>
</nav>
<div class=\"container\">
<h3>Right Aligned Navbar</h3>
<p>some text.</p>
</div>
</body>
</html>
// SNIPPET:
About
// SNIPPET:
angular.module('myApp', ['ngRoute']).
config(['$routeProvider', '$locationProvider', function ($routeProvider, $location) {
$location.html5Mode(true);
$routeProvider.when('/', {
templateUrl: 'home/home.html',
controller:'homeCtrl',
controllerAs: \"vm\",
resolve:{
getData: function(){
var param = $location.search().options
}
}
})
// SNIPPET:
<form method=\"POST\">
<div ng-app=\"myapp\">
<div ng-controller=\"myCtrl\">
<div ng-repeat=\"(field, value) in box.fields\">
<div class=\"my-toggle\" my-toggle=\"field\" ng-bind=\"value['par2']\"></div>
</div>
</div
</div>
</form>
// SNIPPET:
//The question is, how can i overwrite the myCtrl's variable from directive?
//and after, the controller must update the results...
//I heard about bindToController, but I could not get it to work.
//used version 1.4.5
var myapp = angular.module('myapp', []);
myapp.controller('myCtrl', function ($scope){
$scope.box = {
fields : {
fieldOne:{
par1 : 10,
par2 : 12,
},
fieldTwo:{
par1 : 20,
par2 : 24,
},
fieldThree:{
par1 : 30,
par2 : 36,
}
}
};
});
myapp.directive('myToggle', [function(){
return{
restrict: 'A',
scope: {
myToggle : '=',
},
link : function(scope, element, attr){
var startX = 0, x = 0;
var elementLeft = 0;
element.on('mousedown', function(event){
//ctrlSCOPE.fields[scope.mytoggle]['par1'] + 1;
//console.log(ctrlSCOPE.fields[scope.mytoggle]['par2']);
});
},
};
}]);
// SNIPPET:
$http.get(APIroute).
success(function(data, status, headers, config) {
console.log(data);
vm.results = data.SearchResults;
}).
error(function(data, status, headers, config) {
console.log(data);
});
// SNIPPET:
{
\"SearchResults\": [
{
\"PageCount\": \"1\"
},
{
\"SEARCHVAL\": \"ABC Brickworks Food Centre\"
},
{
\"SEARCHVAL\": \"ABC Brickworks Market & Food Centre\"
},
{
\"SEARCHVAL\": \"ADAM ROAD FOOD CENTRE,\\r\\n2 ADAM ROAD,\\r\\nSINGAPORE 283876\"
},
{
\"SEARCHVAL\": \"AMOY STREET FOOD CENTRE,\\r\\nTELOK AYER STREET,\\r\\nSINGAPORE 069111\"
}
]
}
// SNIPPET:
Access-Control-Allow-Origin:*
Access-Control-Request-Method:GET
Cache-Control:max-age=43200
Connection:keep-alive
Content-disposition:inline; filename=onemap.txt
Content-Encoding:gzip
Content-Type:text/plain
Date:Sat, 26 Sep 2015 03:11:42 GMT
Keep-Alive:timeout=20
Server:nginx
Transfer-Encoding:chunked
Vary:Accept-Encoding
// SNIPPET:
SyntaxError: Unexpected token
at Object.parse (native)
at uc (file:///Users/kelvinkoh/Work/SoftEng/lib/js/angular.min.js:15:480)
at Zb (file:///Users/kelvinkoh/Work/SoftEng/lib/js/angular.min.js:82:229)
at file:///Users/kelvinkoh/Work/SoftEng/lib/js/angular.min.js:83:143
at m (file:///Users/kelvinkoh/Work/SoftEng/lib/js/angular.min.js:7:322)
at cd (file:///Users/kelvinkoh/Work/SoftEng/lib/js/angular.min.js:83:125)
at d (file:///Users/kelvinkoh/Work/SoftEng/lib/js/angular.min.js:84:380)
at file:///Users/kelvinkoh/Work/SoftEng/lib/js/angular.min.js:118:334
at n.a.$get.n.$eval (file:///Users/kelvinkoh/Work/SoftEng/lib/js/angular.min.js:132:452)
at n.a.$get.n.$digest (file:///Users/kelvinkoh/Work/SoftEng/lib/js/angular.min.js:129:463)
// SNIPPET:
But I don't know for now how to generate a bundle that I will be able to copy/paste to GoogleAppsScript.
// SNIPPET:
import Point from './Point.js'
import Test from './test.js'
import SpreadSheetLogger from './SpreadSheetLogger.js'
// SNIPPET:
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = \"\";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _PointJs = __webpack_require__(1);
var _PointJs2 = _interopRequireDefault(_PointJs);
var _testJs = __webpack_require__(2);
var _testJs2 = _interopRequireDefault(_testJs);
var _SpreadSheetLoggerJs = __webpack_require__(4);
var _SpreadSheetLoggerJs2 = _interopRequireDefault(_SpreadSheetLoggerJs);
var a = new _PointJs2['default'](1, 2);
/***/ },
/* 1 */
/***/ function(module, exports) {
\"use strict\";
Object.defineProperty(exports, \"__esModule\", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }
var Point = (function () {
function Point(x, y) {
_classCallCheck(this, Point);
this.x = x;
this.y = y;
}
_createClass(Point, [{
key: \"toString\",
value: function toString() {
return \"(\" + this.x + \", \" + this.y + \")\";
}
}]);
return Point;
})();
exports[\"default\"] = Point;
module.exports = exports[\"default\"];
/***/ },
/* 2 */
/***/ function(module, exports) {
\"use strict\";
[....]
/***/ }
/******/ ]);
// SNIPPET:
(function(modules) {
WebPack code
}([
module1,
module2,
...
])
// SNIPPET:
modules
// SNIPPET:
copy/paste
// SNIPPET:
var myObj = {\"name\":\"test\"};
var myClass = function(){
this.obj = myObj;
this.changeObjName = function(){
this.obj.name =\"newValue\";
};
};
var test1 = new myClass();
var test2 = new myClass();
test1.changeObjName();
console.log(test1.obj.name); //returns \"newValue\"
console.log(test2.obj.name); //returns \"newValue\"
// SNIPPET:
test1.changeObjName();
// SNIPPET:
test2.obj.name
// SNIPPET:
var myClass = function(){
this.obj = {\"name\":\"test\"};
this.changeObjName = function(){
this.obj.name =\"newValue\";
};
};
var test1 = new myClass();
var test2 = new myClass();
test1.changeObjName();
console.log(test1.obj.name); //returns \"newValue\"
console.log(test2.obj.name); //returns \"test\"
// SNIPPET:
return {
restrict: 'A',
replace: false,
transclude: false,
scope: true,
templateUrl: \"/modules/didyouknow/views/slideshow-frame.directive.client.view.html\",
link: {
pre: function() {
console.log('a');
},
post: function(scope, element, attrs) {
/**
* scope.frame - frame information
*/
scope.frame = scope[attrs.slideshowFrame];
}
}
};
// SNIPPET:
{{expr}}
// SNIPPET:
<form name=\"frmNewPlace\" ng-submit=\"newPlace()\">
<div class=\"sectionTitle\">Add a new place</div>
<div class=\"contentSection\">
<input type=\"text\" name=\"placeName\" ng-model=\"dataStoreNewPlace.Name\">
<input type=\"submit\" value=\"Add place\" />
</div>
</form>
<div class=\"sectionTitle\">Existing places</div>
<div class=\"contentSection\">
<div id=\"placesGrid\" class=\"grid\" ui-grid=\"gridOptions\"></div>
</div>
// SNIPPET:
function getPlaces($scope, $http){
$scope.gridOptions = {
enableFiltering: true,
columnDefs: [
{field: 'name', displayName: 'Place Name'}]}
$http({method: 'GET', url: 'api/GetPlaces'}).then(function (response) {
$scope.gridOptions.data = response.data;
}, function(response){
console.log('failed:' + response);
});
}
scannfeast.controller('placesController', ['$scope', '$http', function($scope, $http){
getPlaces($scope, $http);
$scope.dataStoreNewPlace = {};
$scope.newPlace = function(){
$http.post('/api/NewPlace', $scope.dataStoreNewPlace).success(function(data){
getPlaces($scope, $http);});
}
}]);
// SNIPPET:
$scope.gridApi.core.queueGridRefresh();
$scope.gridApi.core.refresh();
$scope.gridApi.grid.refreshCanvas();
$scope.gridApi.grid.refreshRows();
// SNIPPET:
$apply()
// SNIPPET:
<div class=\"meter\">
<span style=\"width:502px\"></span>
<p></p>
</div>
// SNIPPET:
div.meter {
position: relative;
width: 500px;
height: 25px;
border: 1px solid #b0b0b0;
margin-top: 50px;
/* viewing purposes */
margin-left: 100px;
/* viewing purposes */
-webkit-box-shadow: inset 0 3px 5px 0 #d3d0d0;
-moz-box-shadow: inset 0 3px 5px 0 #d3d0d0;
box-shadow: inset 0 3px 5px 0 #d3d0d0;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
}
div.meter span {
display: block;
height: 27px;
animation: grower 1s linear;
-moz-animation: grower 1s linear;
-webkit-animation: grower 1s linear;
-o-animation: grower 1s linear;
position: relative;
top: -1px;
left: -1px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: inset 0px 3px 5px 0px rgba(0, 0, 0, 0.2);
-moz-box-shadow: inset 0px 3px 5px 0px rgba(0, 0, 0, 0.2);
box-shadow: inset 0px 3px 5px 0px rgba(0, 0, 0, 0.2);
background-color:#e8e8e8;
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr=#e8e8e8, endColorstr=#ff8d00);
background-image:-moz-linear-gradient(left, #e8e8e8 0%, #ff8d00 46%,#eb0221 100%);
background-image:linear-gradient(left, #e8e8e8 0%, #ff8d00 46%,#eb0221 100%);
background-image:-webkit-linear-gradient(left, #e8e8e8 0%, #ff8d00 46%,#eb0221 100%);
background-image:-o-linear-gradient(left, #e8e8e8 0%, #ff8d00 46%,#eb0221 100%);
background-image:-ms-linear-gradient(left, #e8e8e8 0%, #ff8d00 46%,#eb0221 100%);
background-image:-webkit-gradient(linear, left bottom, right bottom, color-stop(0%,#e8e8e8), color-stop(46%,#ff8d00),color-stop(100%,#eb0221));}
-webkit-background-size: 100%;
-moz-background-size: 100%;
-o-background-size: 100%;
background-size: 100%;
}
div.meter span:before {
content: '';
display: block;
width: 100%;
height: 50%;
position: relative;
top: 50%;
background: rgba(0, 0, 0, 0.03);
}
div.meter p {
position: absolute;
top: 0;
margin: 0 10px;
line-height: 25px;
font-family: 'Helvetica';
font-weight: bold;
-webkit-font-smoothing: antialised;
font-size: 15px;
color: #333;
text-shadow: 0 1px rgba(255, 255, 255, 0.6);
}
@keyframes grower {
0% {
width: 0%;
}
}
@-moz-keyframes grower {
0% {
width: 0%;
}
}
@-webkit-keyframes grower {
0% {
width: 0%;
}
}
@-o-keyframes grower {
0% {
width: 0%;
}
}
// SNIPPET:
$(function(){
var bar = $('span');
var p = $('p');
var width = \"bar.attr('style')\";
width = width.replace(\"width:\", \"\");
width = width.substr(0, width.length-1);
var interval;
var start = 0;
var end = parseInt(width);
var current = start;
var countUp = function() {
current++;
p.html(current + \"%\");
if (current === end) {
clearInterval(interval);
}
};
interval = setInterval(countUp, (1000 / (end + 1)));
});
// SNIPPET:
<% angular %>
// SNIPPET:
{!! blade/laravel !!}
// SNIPPET:
$newData[] = ['id' => $event['id'], 'name' => $event['name'], 'venuename' => $event['venue']['name'], 'numspotsleft' => $numSpotsLeft, 'eventdateusa' => $eventDate['date_usa']];
return htmlspecialchars(json_encode($newData));
// SNIPPET:
<% event.id %>
// SNIPPET:
ng-click
// SNIPPET:
<span ng-init=\"events = {!! $agendaEventData !!}\"></span>
<span ng-repeat=\"event in events \">
<button ng-click=\"toggleModal('<% event.id %>')\">More detail = <% event.id %></button></span>
// SNIPPET:
var agendaEventData = {
'10-17-2015' : [
{content : '<span class=\\\"fc-event-action\\\"><button ng-click=\"toggleModal('event_id')\" class=\"btn btn-default\">working modal</button></span>'},
]
};
// SNIPPET:
'[{\"number\":\"1\",\"id\":\"2\",\"price\":\"100.70\",\"date\":\"2015-10-18 03:00:00\",\"hidden\":\"21\"},
{\"number\":\"2\",\"id\":\"2\",\"price\":\"88.20\",\"date\":\"2015-10-18 04:00:00\",\"hidden\":\"22\"}]';
// SNIPPET:
json = JSON.parse(data);
$.each(json, function(i, v) {
$('<tr/>', {
html: [$('<td/>', {
text: v.number
}), $('<td/>', {
text: v.id
}), $('<td/>', {
text: v.price
}), $('<td/>', {
text: v.date
}), $('<td/>', {
text: 'show details'
}), $('<td/>', {
text: v.hidden
})]
}).appendTo('#dataTables-example tbody')
})
// SNIPPET:
<table class=\"table table-striped table-bordered table-hover\" id=\"dataTables-example\">
<thead>
<tr>
<th>number</th>
<th>id</th>
<th>price</th>
<th>date</th>
<th>show details</th>
<th style=\"display:none;\">hidden identifier</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
// SNIPPET:
hidden
// SNIPPET:
hidden
// SNIPPET:
<th style=\"display:none;\">hidden identifier</th>
// SNIPPET:
show details
// SNIPPET:
$(document).ready(function () {
$(\".button_line\").on('click', \".menu_button\", function (e) {
DoRipple($(this), e);
});
});
var parent, ink, d, x, y;
function DoRipple(parent, e) {
if (parent.find(\".ink\").length == 0) {
parent.prepend(\"<span class='ink'></span>\");
}
ink = parent.find(\".ink\");
ink.removeClass(\"animate\");
if (!ink.height() && !ink.width()) {
d = Math.max(parent.outerWidth(), parent.outerHeight());
ink.css({ height: d, width: d });
}
x = e.pageX - parent.offset().left - ink.width() / 2;
y = e.pageY - parent.offset().top - ink.height() / 2;
ink.css({ top: y + 'px', left: x + 'px' }).addClass(\"animate\");
function removeAnimationClass() {
ink.removeClass(\"animate\");
}
setTimeout(
function () {
ink.removeClass(\"animate\");
}, 650);
}
// SNIPPET:
html, body{
height:100%;
width:100%;
margin:0;
padding:0;
}
.equal, .equal > div[class*='col-'] {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
flex: 1 0 auto;
}
.button_line {
height: 25%;
width: 100%;
}
a.menu_button {
width: 50%;
height: 100%;
float: left;
background-color: white;
display: table;
border-collapse: collapse;
text-decoration: none;
color: black;
position:relative;
overflow:hidden;
cursor:pointer;
}
a.menu_button > .menu_button_content {
display: table-cell;
vertical-align: middle;
}
a.menu_button > .border_overlay {
height:100%;
width:100%;
position:absolute;
border-right: 1px solid #E6F0F0;
border-bottom: 1px solid #E6F0F0;
}
a.menu_button > .menu_button_content > h2 {
text-align: center;
font-size: 1.1em;
font-family: 'Roboto', sans-serif;
font-weight: 400;
}
a.menu_button > .menu_button_content > .menu_button_color_rectangle {
padding: 0;
width: 40px;
height: 3px;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
a.menu_button > .menu_button_content > .menu_button_color_rectangle#residence {
background-color: #74dbce;
}
a.menu_button > .menu_button_content > .menu_button_color_rectangle#citizenship {
background-color: #509194;
}
a.menu_button > .menu_button_content > .menu_button_color_rectangle#forillegals {
background-color: #ff7662;
}
a.menu_button > .menu_button_content > .menu_button_color_rectangle#soonillegals {
background-color: #ffd869;
}
a.menu_button > .menu_button_content > .menu_button_color_rectangle#fastsearch {
background-color: #7b8dd8;
}
a.menu_button > .menu_button_content > .menu_button_color_rectangle#cooperation {
background-color: #bb5b91;
}
a.menu_button > .menu_button_content > .menu_button_color_rectangle#aboutapp {
background-color: #a29994;
}
a.menu_button > .menu_button_content > .menu_button_color_rectangle#settings {
background-color: #f47b50;
}
.ink {
display: block;
position: absolute;
background: #006064;
border-radius: 100%;
transform: scale(0);
}
/*animation effect*/
.ink.animate {
animation: ripple 0.65s linear;
}
@keyframes ripple {
/*scale the element to 250% to safely cover the entire link and fade it out*/
100% {
opacity: 0;
transform: scale(2.5);
}
}
// SNIPPET:
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\"></script>
<div class=\"button_line\">
<a class=\"ol-md-6 menu_button\" id=\"Residence\">
<div class=\"border_overlay\"></div>
<div class=\"menu_button_content\">
<h2 id=\"ResidenceText\">
<asp:Literal runat=\"server\" Text=\"<%$ Resources: Strings, Residence %>\" />
</h2>
<div class=\"menu_button_color_rectangle\" id=\"residence\"></div>
</div>
</a>
<a class=\"ol-md-6 menu_button\" id=\"#\">
<div class=\"border_overlay\"></div>
<div class=\"menu_button_content\">
<h2 id=\"CitizenshipText\">
<asp:Literal runat=\"server\" Text=\"<%$ Resources: Strings, Citizenship %>\" />
</h2>
<div class=\"menu_button_color_rectangle\" id=\"citizenship\"></div>
</div>
</a>
<a class=\"ol-md-6 menu_button\" id=\"#\">
<div class=\"border_overlay\"></div>
<div class=\"menu_button_content\">
<h2 id=\"FastSearchText\">
<asp:Literal runat=\"server\" Text=\"<%$ Resources: Strings, FastSearch %>\" />
</h2>
<div class=\"menu_button_color_rectangle\" id=\"fastsearch\"></div>
</div>
</a>
<a class=\"ol-md-6 menu_button\" id=\"#\">
<div class=\"border_overlay\"></div>
<div class=\"menu_button_content\">
<h2 id=\"CooperationText\">
<asp:Literal runat=\"server\" Text=\"<%$ Resources: Strings, Cooperation %>\" />
</h2>
<div class=\"menu_button_color_rectangle\" id=\"cooperation\"></div>
</div>
</a>
<a class=\"ol-md-6 menu_button\" id=\"#\">
<div class=\"border_overlay\"></div>
<div class=\"menu_button_content\">
<h2 id=\"ForIllegalsText\">
<asp:Literal runat=\"server\" Text=\"<%$ Resources: Strings, ForIllegals %>\" />
</h2>
<div class=\"menu_button_color_rectangle\" id=\"forillegals\"></div>
</div>
</a>
<a class=\"ol-md-6 menu_button\" id=\"#\">
<div class=\"border_overlay\"></div>
<div class=\"menu_button_content\">
<h2 id=\"SoonIllegalsText\">
<asp:Literal runat=\"server\" Text=\"<%$ Resources: Strings, SoonIllegals %>\" />
</h2>
<div class=\"menu_button_color_rectangle\" id=\"soonillegals\"></div>
</div>
</a>
<a class=\"ol-md-6 menu_button\" id=\"#\">
<div class=\"border_overlay\"></div>
<div class=\"menu_button_content\">
<h2 id=\"AboutAppText\">
<asp:Literal runat=\"server\" Text=\"<%$ Resources: Strings, AboutApp %>\" />
</h2>
<div class=\"menu_button_color_rectangle\" id=\"aboutapp\"></div>
</div>
</a>
<a class=\"ol-md-6 menu_button\" id=\"Settings\">
<div class=\"border_overlay\"></div>
<div class=\"menu_button_content\">
<h2 id=\"SettingsText\">
<asp:Literal runat=\"server\" Text=\"<%$ Resources: Strings, Settings %>\" />
</h2>
<div class=\"menu_button_color_rectangle\" id=\"settings\"></div>
</div>
</a>
</div>
// SNIPPET:
app.factory('ListUserResource', ListUserResource);
ListUserResource.$inject = ['$resource'];
function ListUserResource($resource)
var url ='http://10.192.16.28:8080/fsoft-intranet-ws/user/:verb';
return {
theUsers: $resource(url,
{ verb: 'details', pageSize:'@limit', pageNo:'@page' },
{ query: { method: \"GET\", isArray: true }} )};
}
ListUserResource.theUsers.query({ limit : 10, page : 0 })
.$promise.then(function( response ){
console.log(response); },
function( error ){
console.log(\"XHR Failed in getUser.\"+error.data);
})
// SNIPPET:
<div id=\"illustratorcontent\" ng-repeat=\"illustrator in illustrators\">
<article id=\"illustratorcontent{{illustrator.ID}}\">
<header>
<h3>{{illustrator.name}}</h3>
</header>
<div class=\"illustratorcontentext\">
<p>This work is copyrighted and owned by {{illustrator.name}}...</p>
<p>Details of the copyright holder: </p>
<ul class=\"listplacing\">
<li>Name: {{illustrator.name}}</li>
<li>Website: <a href=\"{{illustrator.website}}\">{{illustrator.name}}'s website</a></li>
<li>Website: <a href=\"{{illustrator.website2url}}\">{{illustrator.name}}'s {{illustrator.website2text}}</a></li>
</ul>
</div>
</article>
</div>
// SNIPPET:
function Illustrator ($scope){
$scope.illustrators = [
{
\"ID\" : \"Ilus1\",
\"name\" : \"Ilus1\",
\"website\" : \"http://Ilus1page.com/\"
},{
\"ID\" : \"Ilus2\",
\"name\" : \"Ilus2\",
\"website\" : \"http://Ilus2page.com/\"
}, ...
{
\"ID\" : \"IlusX\",
\"name\" : \"IlusX\",
\"website\" : \"http://IlusXpage.com/\"
\"website2text\" : \"Twitter IlusX\",
\"website2url\" : \"http://twitterilusx.com/\"
}
]
}
// SNIPPET:
<li>Website: <a href=\"{{illustrator.website2url}}\">{{illustrator.name}}'s {{illustrator.website2text}}</a></li>
// SNIPPET:
function DestroyAllCKEDITOR() {
//Destroy all existing instances
for (name in CKEDITOR.instances) {
if (name != \"template\") {
var editor = CKEDITOR.instances[name];
if ((typeof (editor) != 'undefined') && (editor != null)) {
editor.destroy(true);
}
}
};
}
// SNIPPET:
<div class=\"item-container cke_editable_inline cke_contents_ltr\" style=\"position: relative;\" tabindex=\"0\" spellcheck=\"false\" role=\"textbox\" aria-label=\"Rich Text Editor, editor1\" title=\"Rich Text Editor, editor1\" aria-describedby=\"cke_232\">
// SNIPPET:
Math.pow()
// SNIPPET:
Math.E
// SNIPPET:
Math.pow(Math.E, 3) => 20.085536923187664
Math.exp(3) => 20.085536923187668
// SNIPPET:
HTML
// SNIPPET:
JS
// SNIPPET:
Width of listbox-target = listbox-source = ('fullwidth of attributeref-two-listboxes' - 'width of control-buttons') / 2.
// SNIPPET:
function resizeAttributerefTwoListboxes() {
var is_ff = navigator.userAgent.toLowerCase().indexOf('firefox') > -1,
is_ie = navigator.userAgent.toLowerCase().indexOf('MSIE') > -1 || /Trident.*rv[ :]*(\\d+\\.\\d+)/.test(navigator.userAgent);
$(\"div.attributeref-two-listboxes div\").removeAttr(\"style\");
$(\"div.attributeref-two-listboxes\").each(function(){
var that = $(this),
target = that.find(\".listbox-target\"),
source = that.find(\".listbox-source\"),
control = that.find(\".control-buttons\");
if (this.offsetWidth < 420) {
control.find('a[method=\"add\"] > i').addClass(\"fa-angle-up\").removeClass(\"fa-angle-left\");
control.find('a[method=\"remove\"] > i').addClass(\"fa-angle-down\").removeClass(\"fa-angle-right\");
target.css({\"width\":\"100%\"});
control.css({\"width\":\"100%\"});
control.children().css({\"display\":\"inline-block\"});
source.css({\"width\":\"100%\"});
} else { //horizontal alignment
control.find('a[method=\"add\"] > i').addClass(\"fa-angle-left\").removeClass(\"fa-angle-up\");
control.find('a[method=\"remove\"] > i').addClass(\"fa-angle-right\").removeClass(\"fa-angle-down\");
var w = Math.ceil((this.offsetWidth - control[0].offsetWidth - (is_ff || is_ie ? 2 : 1))/2);
target.css({\"width\":w+\"px\"});
source.css({\"width\":w+\"px\"});
control.children().css({\"height\":(target[0].offsetHeight-20)+\"px\"}); //20 - paddings from top and bottom (10+10)
control.css({\"height\":target[0].offsetHeight+\"px\"});
}
});
}
<div class=\"attributeref-two-listboxes\">
<div class=\"listbox-target\" style=\"width: 549px;\">
<select id=\"Objectint_chg_management_change_user\" acode=\"chg_management_change_user\" atype=\"8\" astyle=\"3\" aislist=\"0\" class=\"form-control tooltipstered\" multiple=\"multiple\" style=\"max-width: 750px;\" size=\"4\" name=\"Objectint[chg_management_change_user][]\"></select>
</div>
<div class=\"control-buttons\" style=\"height: 90px;\">
<div style=\"height: 70px;\">
<a class=\"btn btn-primary option mover\" target=\"Objectint_chg_management_change_user\" source=\"Objectint_chg_management_change_user_select\" method=\"add\" href=\"#\">
<i class=\"fa fa-angle-left\"></i>
</a>
<a class=\"btn btn-primary option mover\" target=\"Objectint_chg_management_change_user\" source=\"Objectint_chg_management_change_user_select\" method=\"remove\" href=\"#\">
<i class=\"fa fa-angle-right\"></i>
</a>
</div>
</div>
<div class=\"listbox-source\" style=\"width: 549px;\">
<select id=\"Objectint_chg_management_change_user_select\" acode=\"chg_management_change_user\" atype=\"8\" astyle=\"3\" aislist=\"0\" class=\"form-control\" multiple=\"multiple\" style=\"max-width: 750px;\" size=\"4\" name=\"[]\">
<option value=\"68\">User 1</option>
<option value=\"61\">User 2</option>
<option value=\"76\">User 3</option>
</select>
</div>
// SNIPPET:
var chart;
var series = Array();
socket.on('ping', function(data){
console.log(data);
socket.emit('pong', {beat: 1})
//console.log(i);
requestData(data);
});
function requestData(point) {
if(point !== null){
//console.log('if'+point);
var series = chart.series[0],
shift = series.data.length > 60; // shift if the series is longer than 20
//alert(point);
chart.series[0].addPoint(point, true, shift);
//setTimeout(requestData, 5000);
}
}
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
defaultSeriesType: 'spline',
zoomType: 'x',
backgroundColor: \"#333333\"
},
load: function(){
chart = this;
requestData();
},
title: {
text: 'Bitcoin price'
},
xAxis: {
type: 'datetime',
tickPixelInterval: 150,
maxZoom: 20 * 1000
},
yAxis: {
minPadding: 0.2,
maxPadding: 0.2,
title: {
text: 'Value',
margin: 80
}
},
series: [{
name: 'Bitcoin Price (Spot)',
data: []
}]
});
});
// SNIPPET:
var amount;
var dateN;
function updateChart(){
setTimeout(updateChart, 5000);
dateN =(Math.floor(new Date().getTime() /1000)*1000); // equal to time() in php
client.getSpotPrice({'currency': 'USD'}, function(err, obj) {
amount = obj.data.amount;
});
var info = [dateN,amount+phpjs.rand(01,99)];
var pointd = JSON.stringify(info);
console.log(pointd);
//console.log(amount);
pointd = phpjs.str_replace('\"','',pointd);
io.sockets.emit('ping', pointd);
}
io.sockets.on('connection', function (socket) {
socket.on('pong', function(data){
console.log(\"Pong received from client\");
});
});
// SNIPPET:
[1446218389000,323.3578]
// SNIPPET:
<ul class=\"filters\">
<li data=\"1\">filter 1</li>
<li data=\"2\">filter 2</li>
<li data=\"3\">filter 3</li>
<li data=\"4\">filter 4</li>
</ul>
<br>
<ul class=\"items\">
<li data=\"1\">1</li>
<li data=\"2\">2</li>
<li data=\"1\">3</li>
<li data=\"3\">4</li>
<li data=\"4\">5</li>
<li data=\"2\">6</li>
<li data=\"3\">7</li>
<li data=\"4\">8</li>
</ul>
// SNIPPET:
ul {
list-style: none;
padding: 0;
}
.filters li {
float:left;
margin-right: 10px;
cursor: pointer;
}
.items li {
width: 100px;
height: 100px;
background: #ccc;
float: left;
margin: 20px;
}
// SNIPPET:
$(document).ready( function() {
$('.filters li').click( function () {
var data;
data = $(this).attr('data');
$('.items li').each( function() {
if($(this).attr('data') !== data) {
$(this).fadeOut();
}
else {
$(this).fadeIn();
}
});
});
});
// SNIPPET:
var intervalID = setInterval(function(){ ogpeWrapper() }, 10);
function ogpeWrapper() {
$(\"#breadcrumbWrapper, #leftColWrapper, #rightColWrapper\").wrapAll('<div id=\"colWrapperContainer\"></div>');
}(jQuery);
function myStopFunction() {
if (document.getElementById('colWrapperContainer')) {
clearInterval(intervalID);
setIntervalID = undefined;
}
}
// SNIPPET:
(function($) {
$(\"#breadcrumbAds, #breadcrumbWrapper, #containerTopParsys, #leftColWrapper, #rightColWrapper\").wrapAll('<div id=\"colWrapperContainer\"></div>');
})(jQuery);
// SNIPPET:
uploader = new qq.FineUploader({
element: $('#manual-fine-uploader1')[0],
request: {
endpoint: Url.AddEvaluationFiles,
},
autoUpload: false,
text: {
uploadButton: '<i class=\"icon-plus icon-white\"></i> Select Files'
},
debug: true,
callbacks: {
onSubmit: function (id, fileName) {
},
onStatusChange: function (id, oldStatus, newStatus) {
if (newStatus == \"uploading\") {
alert(\"Add header\");
}
},
onUpload: function (id, name) {
alert(\"Onupload\");
this.append(\"RequestId\", $(\"#ReqId\").val());
}
}
});
// SNIPPET:
$.ajax({
type: \"POST\",
url: Url.Details,
data: fileData,
async: false,
success: function (result) {
if (result == 0) {
toastr.error(\"Please pass user id\");
} else {
$(\"#ReqId\").val(result);
alert($(\"#ReqId\").val());
uploader.uploadStoredFiles();
}
},
error: function (err) {
toastr.error(\"Not able to upload art details\");
}
});
// SNIPPET:
<exception>: Af
message: \"not a string\"
name: \"InvalidValueError\"
stack: \"Error↵ at Error (native)↵ at new Af (http://maps.googleapis.com/maps-api-v3/api/js/21/10/intl/de_ALL/main.js:26:682)↵ at Bf (http://maps.googleapis.com/maps-api-v3/api/js/21/10/intl/de_ALL/main.js:26:795)↵ at http://maps.googleapis.com/maps-api-v3/api/js/21/10/intl/de_ALL/main.js:28:60↵ at http://maps.googleapis.com/maps-api-v3/api/js/21/10/intl/de_ALL/main.js:28:181↵ at http://maps.googleapis.com/maps-api-v3/api/js/21/10/intl/de_ALL/main.js:28:401↵ at Zh.setIcon (http://maps.googleapis.com/maps-api-v3/api/js/21/10/intl/de_ALL/main.js:31:1423)↵ at $setIcon_6 (0.js:59576:15)↵ at $update_10 (0.js:98065:3)↵ at $liveTimerFireEvent (0.js:113687:7)\"
__proto__: c
c: Object
anchor: U
origin: U
size: W
url: \"resources/image.png\"
__proto__: Object
this: undefined
// SNIPPET:
/*
* declare map as a global variable
*/
var map;
/*
* use google maps api built-in mechanism to attach dom events
*/
google.maps.event.addDomListener(window, \"load\", function () {
/*
* create map
*/
var map = new google.maps.Map(document.getElementById(\"map_div\"), {
center: new google.maps.LatLng(33.808678, -117.918921),
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
/*
* create infowindow (which will be used by markers)
*/
var infoWindow = new google.maps.InfoWindow();
/*
* marker creater function (acts as a closure for html parameter)
*/
function createMarker(options, html) {
var marker = new google.maps.Marker(options);
if (html) {
google.maps.event.addListener(marker, \"click\", function () {
infoWindow.setContent(html);
infoWindow.open(options.map, this);
});
}
return marker;
}
/*
* add markers to map
*/
var marker0 = createMarker({
position: new google.maps.LatLng(33.808678, -117.918921),
map: map,
icon: { url : \"http://1.bp.blogspot.com/_GZzKwf6g1o8/S6xwK6CSghI/AAAAAAAAA98/_iA3r4Ehclk/s1600/marker-green.png\" }
}, \"<h1>Marker 0</h1><p>This is the home marker.</p>\");
var marker1 = createMarker({
position: new google.maps.LatLng(33.818038, -117.928492),
map: map
}, \"<h1>Marker 1</h1><p>This is marker 1</p>\");
var marker2 = createMarker({
position: new google.maps.LatLng(33.803333, -117.915278),
map: map
}, \"<h1>Marker 2</h1><p>This is marker 2</p>\");
setInterval(function(){ marker0.setIcon({ url : \"http://1.bp.blogspot.com/_GZzKwf6g1o8/S6xwK6CSghI/AAAAAAAAA98/_iA3r4Ehclk/s1600/marker-green.png\" }); alert(\"called\");}, 3000);
});
// SNIPPET:
<script type=\"text/javascript\" src=\"http://maps.googleapis.com/maps/api/js?v=3&amp;sensor=false\"></script>
<div id=\"map_div\" style=\"height: 400px;\"></div>
// SNIPPET:
app.ActorView = Backbone.View.extend({
modelImg:'', ....
// SNIPPET:
render: function () {this.$el.html(this.template({
modImg: this.modelImg.toJSON(),
mod: this.model.toJSON(),
movies: this.collection.toJSON()}
// SNIPPET:
modActor.fetch().done(function () {
modActorMovies.fetch().done(function () {
modImgActor.fetch().done(function () {
var actorView = new app.ActorView({
modelImg: modImgActor,<--problematic model
model: modActor,
collection: modActorMovies
});
// SNIPPET:
app.ActorImg= Backbone.Model.extend({
url: \"http://umovie.herokuapp.com/unsecure/actors/272994458/movies\",
parse: function (response) {
return response.results[0];
}
});
// SNIPPET:
$wgHooks['ParserFirstCallInit'][] = 'AllQuesttableFunction';
$wgExtensionMessagesFiles['AllQuestTable'] = __DIR__ . '/_questtable.i18n.php';
function AllQuesttableFunction( &$parser ) {
$parser->setFunctionHook( 'questtable', 'AllQuestTableParserFunction' );
return true;
}
function AllQuestTableParserFunction( &$parser, $arg1='', $arg2='', $arg3='' ) {
$tableend = '<br><div class=\"hbody\"><table class=\"lists list_basicitem width_100p\" id=\"serverTable\"><thead><tr><th>Area</th><th>Quest Name</th><th>Min<br>Level</th><th style=\"width:200px !important\">Rewards</th></tr></thead></table><div class=\"cl\"></div></div>';
return array( $tableend, 'noparse' => true, 'isHTML' => true );
}
$wgHooks['ParserBeforeTidy'][] = 'wgAddJquery';
function wgAddJquery(&$parser, &$text) {
global $addJqueryScripts, $wgLang;
$code = $wgLang->getCode();
if ($addJqueryScripts === true) return true;
$parser->mOutput->addHeadItem(
' <script type=\"text/javascript\" language=\"javascript\" src=\"http://mywiki.com/wiki/extensions/DataTables/DataTables-1.10.0/media/js/jquery.js\"></script>
<script type=\"text/javascript\" language=\"javascript\" src=\"http://mywiki.com/wiki/extensions/DataTables/DataTables-1.10.0/media/js/jquery.dataTables.js\"></script>
<script type=\"text/javascript\" language=\"javascript\" >
$(document).ready(function() {
var dataTable = $(\"#serverTable\").DataTable( {
\"columnDefs\": [
{
targets: 0,
className: \\'al\\'
},
{
targets: 1,
className: \\'al\\',
type: \"num-html\"
},
{
targets: 2,
className: \\'ar\\'
},
{
targets: 3,
className: \\'al\\'
},
{ targets: \\'no-sorting\\', orderable: false }
],
\"processing\": true,
\"language\": {
\"processing\": \"<img src=\\'2.gif\\'>\"
},
\"serverSide\": true,
\"order\": [[ 2, \"desc\" ]],
\"ajax\":{
url :\"http://mywiki.com/wiki/extensions/quest_tables/_questtables_ajax.php?lowerlevel=' . $arg1 . '&higherlevel=' . $arg2 . '&race=' . $arg3 . '&lang=en\",
type: \"post\",
}
} );
} );
</script>'
);
$addJqueryScripts = true;
return true;
}
// SNIPPET:
this.addMenu = function(currentMerchant) {
var id = currentMerchant.id;
function getMenu(id) {
var deferred = Q.defer();
var url = 'https://api.delivery.com/merchant/'+id+'/menu?client_id=xyz';
request.get(url, function(error, response, body) {
if(error) {
console.log(\"Something went wrong with menu GET request: Status Code: \" + response.statusCode);
deferred.reject(new Error(error));
} else if(!error && response.statusCode == 200) {
menuObj = JSON.parse(body);
deferred.resolve(menuObj);
}
});
return deferred.promise;
};
this.data.menu = getMenu(id).then(function(currentMenu) {
return currentMenu;
});
console.log(this.data.menu);
};
// SNIPPET:
var xhr = cc.loader.getXMLHttpRequest();
// SNIPPET:
..../script/jsb_boot.js:360:ReferenceError: XMLHttpRequest is not defined
// SNIPPET:
FluentWait
// SNIPPET:
poll_frequency
// SNIPPET:
ignored_exceptions
// SNIPPET:
WebDriverWait
// SNIPPET:
browser.wait()
// SNIPPET:
browser.wait()
// SNIPPET:
TabView
// SNIPPET:
Tab
// SNIPPET:
TabView {
id: tabView1
property string tabs: \"/etc,/bin\"
function loadTabs() {
var tab_array = tabs.split(\",\");
for (var i = 0; i < tab_array.length; i ++) {
var dirTableView = Qt.createComponent(\"dirview.qml\");
var newTab = tabView1.addTab(\"\", dirTableView);
newTab.active = true;
newTab.item.folderUrl = \"file://\" + tab_array[i];
newTab.title = Qt.binding(function() {
return newTab.item.folderUrl.toString().replace(\"file://\", \"\");
});
}
}
Component.onCompleted: {
loadTabs();
}
}
// SNIPPET:
Tab
// SNIPPET:
TableView
// SNIPPET:
dirview.qml
// SNIPPET:
Tab.title
// SNIPPET:
newTab
// SNIPPET:
Tab
// SNIPPET:
Tab
// SNIPPET:
TabView.addTab()
// SNIPPET:
property var tabArray: []
function loadTabs() {
var tab_array = tabs.split(\",\");
for (var i = 0; i < tab_array.length; i ++) {
var dirTableView = Qt.createComponent(\"dirview.qml\");
tabArray[i] = tabView1.addTab(\"\", dirTableView);
tabArray[i].active = true;
tabArray[i].item.folderUrl = \"file://\" + tab_array[i];
tabArray[i].title = Qt.binding(function() {
return tabArray[i].item.folderUrl.toString().replace(\"file://\", \"\");
});
}
}
// SNIPPET:
Qt.binding()
// SNIPPET:
Qt.binding()
// SNIPPET:
item.folderUrl
// SNIPPET:
Qt.binding
// SNIPPET:
$(window).bind(\"load\", function() {
var footerHeight = 0,
footerTop = 0,
$footer = $(\".footer\");
positionFooter();
function positionFooter() {
footerHeight = $footer.height();
footerTop = ($(window).scrollTop()+$(window).height()-footerHeight)+\"px\";
if ( ($(document.body).height()+footerHeight) < $(window).height()) {
$footer.css({
position: \"absolute\"
}).animate({
top: footerTop
})
} else {
$footer.css({
position: \"static\"
})
}
}
$(window)
.scroll(positionFooter)
.resize(positionFooter)
});
// SNIPPET:
html, body {
height: 100%;
}
*{
margin: 0;
}
body {
background: #fff;
min-height: 600px;
}
body * {
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #393c3d;
line-height: 22px;
}
#fw_header {
margin: 0 auto;
position: relative;
width: 980px;
}
#fw_header ul {
list-style-type: none;
}
.forums #fw_header {
margin-bottom: 0;
}
#fw_header ul {
padding-left: 12px;
padding-top: 6px;
}
#fw_header li {
float: left;
padding: 0 3px;
}
#fw_header li a {
padding: 0 8px;
}
#fw_header li a:hover {
border-bottom: 5px solid #829AC6;
text-decoration: none;
}
#fw_header li a.active {
border-bottom: 5px solid #4E6CA3;
}
#fw_header ul.submenu li a.active,
#fw_header ul.subsubmenu li a.active {
border-bottom: 5px solid #829AC6;
}
#fw_header ul.submenu,
#fw_header ul.subsubmenu {
margin-top: 1em;
padding-top: 0;
}
#fw_header ul.submenu_usage {
padding-left: 32px;
}
#fw_header ul.submenu_plugins {
padding-left: 20px;
}
#fw_header ul.submenu_development {
padding-left: 23px;
}
#fw_header ul.submenu_extras {
padding-left: 14px;
}
#fw_header ul.submenu_testing {
padding-left: 480px;
}
#fw_header ul.submenu_styling {
padding-left: 80px;
}
#fw_header ul.subsubmenu {
padding-left: 120px;
}
#fw_header ul.submenu li,
#fw_header ul.subsubmenu li {
font-size: 80%;
}
#fw_header {
font-size: 16px;
}
#fw_header a {
color: #4E6CA3 !important;
}
#fw_header h1 {
border-bottom: medium none;
color: black;
font-size: 2em;
line-height: 1.45em;
margin-top: 32px;
vertical-align: middle;
}
#fw_header h1 img {
margin-top: -5px;
vertical-align: middle;
}
#fw_header h1 a {
color: black !important;
}
#fw_header h1 a:hover {
text-decoration: none;
}
#header_options {
position: absolute;
right: 150px;
top: -32px;
width: 495px;
}
#header_options .option {
float: left;
padding: 12px 0;
text-align: center;
width: 165px;
}
#header_options a:hover {
text-decoration: none;
}
#header_options .option:hover {
background-color: #F5F7FA;
}
#header_options div.option img {
margin-right: 7px;
vertical-align: middle;
}
#header_options .option table {
margin: 0 auto;
}
#header_options .option table td {} #header_options #options_search {
padding: 7px 0;
width: 495px;
}
#header_options #options_download {} #options_search input[type=\"text\"] {
height: 20px;
width: 350px;
}
#header_download {
background: url(\"../images/dl_button_220.jpg\") no-repeat scroll left top transparent;
font-size: 0.9em;
height: 36px;
padding-top: 13px;
position: absolute;
right: 0;
text-align: center;
top: -8px;
width: 220px;
}
#header_donate {
background: url(\"../images/donate_button.jpg\") no-repeat scroll left top transparent;
font-size: 0.9em;
height: 36px;
padding-top: 13px;
position: absolute;
right: 220px;
text-align: center;
top: -8px;
width: 220px;
}
#header_download a,
#header_donate a {
color: white;
}
#header_download a:hover,
#header_donate a:hover {
text-decoration: none;
}
#dontate_wrapper {
background-color: #FCFCFC;
border: 1px dotted #A5A5A5;
color: #555555;
font-size: 0.8em;
margin: 0 0 1.5em;
padding: 5px;
text-align: center;
}
#header_advert {
background-color: white;
height: 200px;
overflow: visible;
position: absolute;
right: 0;
top: -32px;
width: 150px;
}
body .adpacks {} body .one .bsa_it_ad {
background: none repeat scroll 0 0 transparent;
border: medium none;
color: #999999;
margin: 0;
text-align: left;
}
body .one .bsa_it_ad:hover {
background-color: #F5F7FA;
color: black;
}
body .one .bsa_it_ad .bsa_it_i {
display: block;
float: none;
font-size: 11px !important;
margin: 0;
padding: 0;
text-align: center;
}
body .one .bsa_it_ad .bsa_it_d {
font-size: 11px !important;
}
body .one .bsa_it_ad .bsa_it_i img {
border: medium none;
padding: 0;
}
body .one .bsa_it_ad .bsa_it_t {
padding: 6px 0 0;
}
body .one .bsa_it_p {
display: none;
}
.one .bsa_it_ad {
color: #F5F7FA;
padding: 4px 0 0 !important;
}
body #bsap_aplink,
body #bsap_aplink:hover {
display: block;
font-size: 10px;
left: 104px;
position: absolute;
text-decoration: none;
top: 45px;
transform: rotate(90deg);
width: 100px;
}
.css_small {
font-size: 75%;
line-height: 1.45em;
}
.css_vsmall {
font-size: 65%;
line-height: 1.45em;
}
#dt_example #container {
margin: 64px auto 30px !important;
}
.header {
width: 100%;
background: rgba(255, 255, 255, 0.6);
color: #034e7c;
text-align: center;
padding: 20px 0;
height: 115px;
// filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D73000', endColorstr='#FFFFFF',GradientType=0 ); /* IE6-9 */
}
.header img.logo {
height: 105px;
}
.header ul.breadcrumb li a {
font-family: 'Open Sans';
font-size: 23px;
color: #4a4a4a
}
.header ul.log-in {
list-style-type: none;
display: inline;
float: right;
margin-top: 55px;
margin-right: 40px;
}
.header ul li {
display: inline;
color: red;
margin-right: 35px;
}
.header ul.log-in li,
.header ul.log-in li a {
display: inline;
font-size: 19px;
color: red;
text-decoration: none
}
.header .dateButton,
.dateButton {
width: 300px;
height: 45px;
background: #e63308;
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJod…EiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #e63308 0%, #db3304 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #e63308), color-stop(100%, #db3304));
background: -webkit-linear-gradient(top, #e63308 0%, #db3304 100%);
background: -o-linear-gradient(top, #e63308 0%, #db3304 100%);
background: -ms-linear-gradient(top, #e63308 0%, #db3304 100%);
background: linear-gradient(to bottom, #e63308 0%, #db3304 100%);
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#e63308', endColorstr='#db3304', GradientType=0);
float: right;
-webkit-border-radius: 2px;
border-radius: 2px;
margin-right: 70px;
text-align: center;
cursor: pointer;
margin-top: -8px;
}
.header .dateButton a,
.dateButton a {
height: 30px;
vertical-align: middle;
line-height: 45px;
font-weight: bold;
color: #f0f0f0;
font-size: 23px;
}
.header .dateButton img,
.dateButton img {
padding-right: 5px
}
.footer {
width: 100%;
background: #FFF;
text-align: center;
height: 40px;
}
.footer p {
color: #4a4a4a;
font-family: 'Open Sans', sans-serif;
padding: 30px 0;
}
.footer p a {
color: #9fcf64;
}
.navigation {
min-width: 1300px;
width: 100%;
border-top: solid 1px #d6d6d6;
border-bottom: solid 1px #d6d6d6;
height: 60px;
background: linear-gradient(to bottom, #f5f5f5 0%, #ececec 10%, #ededed 100%);
}
.navigation ul.breadcrumb {
padding: 0px;
margin: 0;
margin-left: 50px;
margin-top: 15px;
margin-right: 0px;
width: 1000px;
}
.navigation ul li {
list-style-type: none;
}
.navigation ul li a {
color: #4a4a4a;
text-decoration: none;
font-weight: bold;
font-size: 23px;
float: left;
margin-right: 10px;
}
.triangle {
width: 0px;
height: 0px;
border-style: solid;
border-width: 3px 0 3px 5.2px;
border-color: transparent transparent transparent #4a4a4a;
float: left;
margin-top: 8px;
margin-right: 10px;
}
.top-section {
height: 100px;
}
body * {
font-family: 'Open Sans', sans-serif;
font-size: 16px;
color: #393c3d;
line-height: 22px;
}
.bg-photo{
background:url(http://planet.nu/dev/test/images/bg.jpg);
background-size: cover;
height: 75%;
text-align: center;
}
.bg-photo:before{
content: '';
display: inline-block;
vertical-align: middle;
margin-right: -0.25em;
}
.loginText{
font-size: 16px;
}
#createCampaignButton {
transition-property: background-color, color;
transition-duration: 1s;
transition-timing-function: ease-out;
font-size: 18px;
/* font-weight: bold; */
color: #fff;
background: #8bbd3a;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
table{
margin-bottom: 20px;
background: rgba(255, 255, 255, 0.9);
}
h1{
color: #4a4a4a;
font-size: 48px;
}
table th{
color: #666666;
padding-top: 10px;
text-align: left;
padding-left: 15px;
}
table td {
padding-left: 15px;
}
table td input{
padding-left: 5px;
height: 30px;
font-size: 22px;
margin-bottom: 20px;
width: 100%;
}
tbody{
width: 95%;
display: table;
}
// SNIPPET:
<div class=\"header\">
<div class=\"top-section\">
<img class=\"logo\" src=\"http://planet.nu/dev/test/images/littleforest_logo.jpg\">
</div>
</div>
<div class=\"bg-photo col-md-12 col-xs-12\">
<div class=\"col-md-6 col-sm-9\">
<h1 style=\"font-size: 35px; text-align:center; color:#FFF;margin:20px 0 0 0\">
Welcome to LFi
</h1>
<p style=\"text-align:center; color: #FFF; font-size: 20px; padding: 28px 0 0 0;\">Insight that drives web success</p>
<br>
<form method=\"post\" action=\"/crawler/LoginServlet\">
<table style=\"width: 40%; padding: 20px 30px; display: inline-block; vertical-align: middle; margin: 30px 0 0 0; background: rgba(255,255,255, 0.9);\">
<tbody>
<tr>
<th>
User Name
</th>
</tr>
<tr>
<td>
<input type=\"text\" name=\"username\" class=\"textInput loginText\" placeholder=\"User Name\">
</td>
</tr>
<tr>
<th>
Password
</th>
</tr>
<tr>
<td>
<input type=\"password\" name=\"password\" value=\"\" class=\"textInput loginText\" placeholder=\"Password\">
</td>
</tr>
</tbody>
</table>
<div>
<p class=\"submit\">
<input type=\"submit\" name=\"commit\" class=\"button\" id=\"createCampaignButton\" value=\"Log in\" style=\"width:260px; display: inline-block; vertical-align: middle; margin: 20px 0 0 0;\">
</p>
</div>
</form>
</div>
</div>
<div class=\"footer col-md-12 col-xs-12\">
<p>
Powered by <a href=\"http://www.littleforest.co.uk/\" style=\"color: #65892a; text-decoration: none; font-weight: bold;\">Little Forest</a> a tool that encourages continuous improvement towards web success.
</p>
</div>
// SNIPPET:
`var data = {\"data\":[{\"student_name\":\"jack\",\"subjects\":{\"math\":{\"cat1_grade\":\"30\",\"cat2_grade\":\"39\",\"cat3_grade\":\"38\"},\"english\":{\"cat1_grade\":\"30\",\"cat2_grade\":\"39\",\"cat3_grade\":\"38\"},\"swahili\":{\"cat1_grade\":\"30\",\"cat2_grade\":\"39\",\"cat3_grade\":\"38\"}},\"subject1_average\":\"35\",\"subject2_average\":\"26\",\"subject3_average\":\"59\"}]};
/* Formatting function for row details - modify as you need */
function format ( d ) {
// `d` is the original data object for the row
var header = false;
var detail_table = $(\"<table></table>\",{
\"cellpadding\":\"5\",
\"cellspacing\": \"0\",
\"border\": \"0\",
\"style\":\"padding-left:50px;\"
});
var tbody = $(\"<tbody></tbody>\");
detail_table.append(tbody);
$.each(d.subjects, function(k, v){
var tbody_row = $(\"<tr></tr>\").append($(\"<td></td>\",{\"text\": k}));
if(!header){
var thead = $(\"<thead></thead>\");
var thead_row = $(\"<tr></tr>\")
thead_row.append($(\"<th></th>\",{\"text\":\" \"}));
$.each(v, function(a, b){
thead_row.append($(\"<th></th>\",{\"text\":a}));
tbody_row.append($(\"<td></td>\",{\"text\":b}));
});
thead.append(thead_row);
detail_table.append(thead);
header = true;
}else{
$.each(v, function(a, b){
tbody_row.append($(\"<td></td>\",{\"text\":b}));
});
}
tbody.append(tbody_row);
});
return detail_table;
}
$(document).ready(function() {
var table = $('#example').DataTable( {
\"ajax\": {
\"url\": '/echo/js/?js=' + encodeURIComponent(JSON.stringify(data)),
},
\"columns\": [
{
\"className\": 'details-control',
\"orderable\": false,
\"data\": null,
\"defaultContent\": ''
},
{ \"data\": \"student_name\" },
{ \"data\": \"subject1_average\" },
{ \"data\": \"subject2_average\" },
{ \"data\": \"subject3_average\" }
],
\"order\": [[1, 'asc']]
} );
// Add event listener for opening and closing details
$('#example tbody').on('click', 'td.details-control', function () {
var tr = $(this).closest('tr');
var row = table.row( tr );
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
}
else {
// Open this row
row.child( format(row.data()) ).show();
tr.addClass('shown');
}
} );
} );
// SNIPPET:
$.each(v, function(a, b){
tbody_row.append($(\"<td></td>\",{\"text\":b}));
});
// SNIPPET:
{\"text\":b}
// SNIPPET:
for $x in doc(\"http://www.domain.com\")/body/div
return if ($x/@id=\"content\")
then <h1>{data($x/div[3]/span)}</h1>
else <h1> Nothing </h1>
// SNIPPET:
<div><p>Value </p></div>
// SNIPPET:
Posts = new Mongo.Collection('posts');
PostsIndex = new EasySearch.Index({
collection: Posts,
fields: ['title','tags.tags'],
engine: new EasySearch.Minimongo()
// name: 'PostsIndex',
// permission: function(options) {
// return userHasAccess(options.userId); // always return true or false here
// }
});
Posts.allow({
insert: function(userId, doc) {
return !!userId;
}
});
Schema = {};
Schema.Tags = new SimpleSchema({
tags: {
type: String
}
});
Schema.PostsSchema = new SimpleSchema({
title: {
type: String,
label: '',
max: 250,
min: 3
},
tags: {
type: [Schema.Tags]
},
authorId: {
type: String,
label: 'Author',
autoValue: function(){
return this.userId
},
autoform: {
type: 'hidden'
}
},
authorName: {
type: String,
label: 'AuthorName',
autoValue: function(){
return this.userId.username
},
autoform: {
type: 'hidden'
}
},
createdAt: {
type: Date,
label: 'CreatedAt',
autoValue: function(){
return new Date()
},
autoform: {
type: 'hidden'
}
}
});
Posts.attachSchema(Schema.PostsSchema);
// SNIPPET:
var xhr = new XMLHttpRequest();
if ('withCredentials' in xhr) {
xhr.open('POST', 'http://xbo.dev/ajax/check_login_ajax', true);
// I am using hard coding for the URL because with Routing.generate I would have this URL : http://blog.xbo.dev/ajax/check_login_ajax
// which is not good because the request is on a different domain
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status >= 200 && xhr.status < 400) {
console.log(xhr);
console.log('ok');
} else {
console.log('ko');
}
}
};
xhr.send(encodeURI('_username=' + $('#co_'+varName+'username').val() + '&_password=' + $('#co_'+varName+'password').val() + '&_remember_me=' + false + '&_csrf_token=' + $('#co__csrf_token').val()));
// SNIPPET:
$.post(geographicServiceUrl + \"/addPolygon\",
{ name: document.getElementById('polygonName').value, path: latLongStrings }
, function (data) {
doSomeStuff(data);
});
// SNIPPET:
{
\"name\": \"\",
\"description\": \"\",
\"license\": \"MIT\",
\"repository\": {},
\"dependencies\": {
\"babelify\": \"^7.2.0\",
\"browserify\": \"^12.0.1\",
\"browserify-incremental\": \"^3.0.1\"
}
}
// SNIPPET:
<div id=\"summary\" style=\"position: relative;width: 100%;height: 100%;\">
<h2 id=\"summary-ip\" class=\"sub-header\">IPs</h2>
<div id=\"ip-container\" style=\"width: 100%;height: auto; text-align:center;\">
<canvas style=\"width: 100%;height: auto;\" id=\"ip\"></canvas>
</div>
<script>
var contextIP = document.getElementById('ip').getContext('2d');
var optionsIP = {
barValueSpacing: 1,
maintainAspectRatio: false,
responsive:true
};
var dataIPs = {
labels: <<VALUES>>,
datasets: [
{
label: \"My First dataset\",
fillColor: \"rgba(151,187,205,0.5)\",
strokeColor: \"rgba(151,187,205,0.8)\",
highlightFill: \"rgba(151,187,205,0.75)\",
highlightStroke: \"rgba(151,187,205,1)\",
data: <<VALUES>>
}
]
};
var chartIPs = new Chart(contextIP).HorizontalBar(dataIPs, optionsIP);
// SNIPPET:
var data = {\"name\":\"John\", \"age\": 34}
$.ajax({
type: 'POST',
contentType: 'text/json',
url: 'http://myapp.meteor.com/',
crossDomain: true,
data: data,
dataType: 'html',
success: function(responseData, textStatus, jqXHR) {
var value = responseData.someKey;
console.log(responseData);
},
error: function (responseData, textStatus, errorThrown) {
alert('POST failed.');
console.log(responseData);
}
});
// SNIPPET:
var garbageHtml = \\\"<a> <img class='delete' src='https://d1dxeoyimx6ufk.cloudfront.net/ct/images/c_garbage.gif' style='cursor: hand;' title='Delete Draft' onClick='deleteMyIdeaDraftRequest()'/></a>\\\";
function deleteMyIdeaDraftRequest(draft_id)
{
console.log('delete draft');
BI.ajax_call('ct_xt_delete_my_idea_draft.bix?c=$campaign_id', 'POST', {'draft_id':draft_id}, deleteMyIdeaDraftExecute);
}
function deleteMyIdeaDraftExecute(response_, error_)
{
// Check if any javascript errors occurred
if(error_)
{
openMessageBox('Server Error', error_);
return false;
}
var deleted_draft_id = response_.responseText;
var obj_draft = document.getElementById(deleted_draft_id);
if(obj_draft)
{
document.getElementById('my_idea_drafts_container').removeChild(obj_draft);
}
}
// SNIPPET:
var arr = [{
EmployeeInfo: [{
annualWage: \"24000\"
}],
name: \"Tim\",
surname: \"Jones\",
id: \"1111\"
}, {
EmployeeInfo: [{
annualWage: \"52000\"
}],
name: \"Terry\",
surname: \"Phillips\",
id: \"2222\"
}];
console.log(arr);
arr.sort(function (a, b) {
return parseFloat(a.EmployeeInfo[0].annualWage) - parseFloat(b.EmployeeInfo[0].annualWage);
});
console.log(arr);
// SNIPPET:
scriptstart()
// SNIPPET:
scriptEnd()
// SNIPPET:
// view
<?php
$this->Html->scriptStart(array(\"block\"=>true,\"inline\"=>FALSE));
?>
$().ready(function(){
alert(\"dd\");
});
<?php
$this->Html->scriptEnd();
?>
// layout
echo $this->fetch('script');
// SNIPPET:
<form class=\"send-with-ajax\" method=\"post\" action=\"send_form_email.php\">
<div class=\"row\">
<div class=\"three columns alpha\">
<label for=\"first_name\">First Name <span>required</span></label>
<label for=\"last_name\">Last Name <span>required</span></label>
</div>
<div class=\"seven columns omega\">
<input type=\"text\" required placeholder=\"First Name\" id=\"first_name\" name=\"name\">
<input type=\"text\" required placeholder=\"Last Name\" id=\"last_name\" name=\"name\">
</div>
</div>
<div class=\"row\">
<div class=\"three columns alpha\">
<label for=\"email\">Your Email <span>email required</span></label>
</div>
<div class=\"seven columns omega\">
<input type=\"email\" required placeholder=\"your@email\" id=\"email\" name=\"email\">
</div>
</div>
<div class=\"row\">
<div class=\"three columns alpha\">
<label for=\"comments\">Message</label>
</div>
<div class=\"seven columns omega\">
<textarea placeholder=\"Enter you message, and please include your artist name. you can put either or choose between Pervis or Duijuan\" id=\"comments\" name=\"comments\"></textarea>
</div>
</div>
<div class=\"seven columns offset-by-three\">
<button type=\"submit\">Submit Form</button>
<div class=\"ajax-response\"></div>
</div>
</form>
// SNIPPET:
$(\"form.send_form_email\").submit(function(e) {
e.preventDefault();
var form = $(this),
validationErrors = false;
$('.form-error-msg').remove();
form.find(\"input[type='email'], input[required]\").each(function(index){
var inputValue = $(this).val(),
inputRequired = $(this).attr('required'),
inputType = $(this).attr('type');
$(this).removeClass('form-error');
if(inputRequired && inputValue == '') {
$(this).after('<div class=\"form-error-msg\">Please fill out this field.</div>');
$(this).addClass('form-error');
validationErrors = true;
} else if(inputType == 'email' && !isValidEmail(inputValue)) {
$(this).after('<div class=\"form-error-msg\">Please enter an email address.</div>');
$(this).addClass('form-error');
validationErrors = true;
}
});
if (!validationErrors) {
form.find('button:submit, input:submit').html('Sending...');
form.find('.ajax-response').empty();
$.post(form.attr('action'), form.serialize(),
function(data) {
if (data.bFormSent) {
form.find('.ajax-response').empty().html(data.aResults[0]);
form.find('button:submit, input:submit').html('Submit Form');
form.find('#email, #first_name, #last_name #comments').val('');
} else {
form.find('.ajax-response').empty().wrapInner('<div class=\"form-error-msg\"></div>');
form.find('.ajax-response div').html(data.aErrors[0]);
form.find('button:submit, input:submit').html('Try Again');
}
}, 'json');
}
});
// SNIPPET:
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = \"myemail\";
$email_subject = \"this subject\";
function died($error) {
// your error code can go here
echo \"We are very sorry, but there were error(s) found with the form you submitted. \";
echo \"These errors appear below.<br /><br />\";
echo $error.\"<br /><br />\";
echo \"Please go back and fix these errors.<br /><br />\";
die();
}
// validation expected data exists
if(!isset($_POST['first_name' ]) ||
!isset($_POST['last_name']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['comments'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$first_name = $_POST['first_name']; // required
$last_name = $_POST['last_name']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$comments = $_POST['comments']; // required
$error_message = \"\";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp, $email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = \"/^[A-Za-z .'-]+$/\";
if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = \"Form details below.\\n\\n\";
function clean_string($string) {
$bad = array(\"content-type\",\"bcc:\",\"to:\",\"cc:\",\"href\");
return str_replace($bad,\"\",$string);
}
$email_message .= \"First Name: \".clean_string($first_name).\"\\n\";
$email_message .= \"Last Name: \".clean_string($last_name).\"\\n\";
$email_message .= \"Email: \".clean_string($email_from).\"\\n\";
$email_message .= \"Telephone: \".clean_string($telephone).\"\\n\";
$email_message .= \"Comments: \".clean_string($comments).\"\\n\";
// create email headers
$headers = 'From: '.$email_from.\"\\r\\n\".
'Reply-To: '.$email_from.\"\\r\\n\" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
// SNIPPET:
$(document).ready(function () {
$('.menu > li:has(ul)').addClass('menu-dropdown-icon');
//Checks if li has sub (ul) and adds class for toggle icon - just an UI
$(\".menu\").before(\"<a href=\\\"#\\\" class=\\\"menu-mobile\\\">Izbornik</a>\");
//Adds menu-mobile class (for mobile toggle menu) before the normal menu
//Mobile menu is hidden if width is more then 959px, but normal menu is displayed
//Normal menu is hidden if width is below 959px, and jquery adds mobile menu
//Done this way so it can be used with wordpress without any trouble
$(\".menu > li\").hover(function (e) {
if ($(window).width() > 943) {
$(this).children(\"ul\").stop(true, false).slideToggle(600);
e.preventDefault();
}
});
//If width is more than 943px dropdowns are displayed on hover
$(\".menu > li\").click(function () {
if ($(window).width() <= 943) {
$(this).children(\"ul\").fadeToggle(150);
}
});
//If width is less or equal to 943px dropdowns are displayed on click
$(\".menu-mobile\").click(function (e) {
$(\".menu\").slideToggle(300);
e.preventDefault();
});
//when clicked on mobile-menu, normal menu is shown as a list, classic rwd menu story
});
// SNIPPET:
.menu {
margin: 0 auto;
width: 100%;
list-style: none;
padding: 0;
/* IF .menu position=relative -> ul = container width, ELSE ul = 100% width */
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
font-size: 1.4rem;
display: block;
}
.menu:before,
.menu:after {
content: \"\";
display: table;
}
.menu:after {
clear: both;
}
.menu > li {
float: left;
background-color: #1a2b3e;
padding: 0;
margin: 0;
}
.menu > li > a {
text-decoration: none;
padding: .7em 3em;
display: inline-block;
outline: 0 none;
color: #fff;
}
.menu > li:hover {
background: blue;
}
.menu > li:hover > a {
color: #fff;
}
.menu > li > ul {
display: none;
width: 100%;
background: #fff;
padding: 20px;
position: absolute;
z-index: 99;
left: 0;
color: #fff;
margin: 0;
list-style: none;
box-shadow: 0 7px 10px -5px rgba(0, 0, 0, 0.3);
background-color: #1a2b3e;
}
.menu > li > ul > li {
margin: 0;
padding: 15px;
list-style: none;
background: none;
float: left;
width: 33.333%;
}
.menu > li > ul > li a {
padding: .2em 0;
color: #fff;
display: block;
font-size: 1.5rem;
font-weight: 600;
border-bottom: 1px solid #f0f0f0;
text-transform: capitalize;
}
.menu > li > ul > li:last-child {
width: 17%;
}
.menu > li > ul > li:last-child > ul {
-webkit-column-count: 1;
-moz-column-count: 1;
column-count: 1;
}
.menu > li > ul > li:nth-child(2) {
width: 49.666%;
}
.menu > li > ul > li:nth-child(2) > ul {
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
}
.menu > li > ul > li > ul {
display: block;
padding: 0;
margin: 0;
margin-top: 20px;
list-style: none;
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
}
.menu > li > ul > li > ul > li {
width: 100%;
margin-bottom: 10px;
-webkit-column-break-inside: avoid;
/* Chrome, Safari */
page-break-inside: avoid;
/* Theoretically FF 20+ */
break-inside: avoid-column;
/* IE 11 */
display: inline-block;
/* Actually FF 20+ */
}
.menu > li > ul > li > ul > li a {
border: 0;
color: #fff;
font-weight: 300;
font-size: 1.4rem;
text-transform: none;
font-weight: 600;
}
.menu > li > ul > li > ul > li > ul {
list-style: none;
padding: 0;
margin: 0;
}
.menu > li > ul > li > ul > li > ul > li {
margin: 0;
width: 100%;
float: left;
}
.menu > li > ul > li > ul > li > ul > li a {
font-weight: normal;
font-size: 1.2rem;
}
.menu > li > ul > li > ul > li > ul > li > ul {
list-style: none;
margin: 0;
padding: 0;
}
.menu > li > ul > li > ul > li > ul > li > ul > li {
margin: 0;
width: 100%;
float: left;
margin: -5px 0;
}
.menu > li > ul > li > ul > li > ul > li > ul > li:last-child {
margin-bottom: 5px;
}
.menu > li > ul > li > ul > li > ul > li > ul > li a {
text-transform: capitalize;
font-weight: normal;
font-size: .9rem;
}
@media only screen and (max-width: 959px) {
.menu-container {
width: 100%;
}
.menu-mobile {
display: block;
}
.menu-dropdown-icon:before {
display: block;
}
.menu {
display: none;
}
.menu > li {
width: 100%;
float: none;
display: block;
}
.menu > li a {
padding: 1.5em;
width: 100%;
display: block;
}
.menu > li > ul {
position: relative;
}
.menu > li > ul > li {
float: none;
width: 100%;
border: 0;
display: block;
}
.menu > li > ul > li:first-child {
margin: 0;
}
.menu > li > ul > li > ul {
position: relative;
}
.menu > li > ul > li > ul > li {
float: none;
}
}
// SNIPPET:
angular.module('app', ['ngResource', 'ngRoute']);
angular.module('app').config(function($routeProvider,$locationProvider){
$locationProvider.html5Mode(true);
$locationProvider
.when('/', {
templateUrl : '/partials/main',
controller: 'mainCtrl'
});
});
angular.module('app').controller('mainCtrl', function($scope){
$scope.myVar = \"Hello Angular\";
});
// SNIPPET:
angular.module('app').config(['$routeProvider', '$locationProvider',
function($routeProvider,$locationProvider){
$locationProvider.html5Mode(true);
$locationProvider.when('/', {templateUrl : '/partials/main', controller: 'mainCtrl'});
}]);
// SNIPPET:
var conditions = [];
conditions [0] = [\"0\", \"1\", \"2\", \"3\", \"4\"];
conditions [1] = [\"5\", \"6\", \"7\", \"8\", \"9\"];
conditions [2] = [\"19\", \"20\", \"21\", \"22\"];
conditions [3] = [\"13\", \"14\", \"15\", \"16\"];
// SNIPPET:
if(weather.code === **item in conditions[1] for example**) {
$(\"#page\").css({background: \"#F7AC57\"}, 1500);
}
else {
$('#page').css({background: \"#000\"}, 1500);
}
// SNIPPET:
function Find(txt) {
var iframe = document.getElementById(\"Text_ifr\");
var iframe_contents = iframe.contentDocument.body.innerHTML;
if (iframe_contents.indexOf(txt) >= 0) {
alert('Found')
}
else { alert('Not Found') }
return false;
}
function replaceSelectedText(replacementText) {
var iframe = document.getElementById(\"Text_ifr\");
var win = iframe.contentWindow;
var doc = iframe.contentDocument || win.document;
var sel, range;
if (win.getSelection) {
sel = win.getSelection();
if (sel.rangeCount) {
range = sel.getRangeAt(0);
range.deleteContents();
range.insertNode(doc.createTextNode(replacementText));
}
} else if (doc.selection && doc.selection.createRange) {
range = doc.selection.createRange();
range.text = replacementText;
}
}
// SNIPPET:
<iframe id=\"Text_ifr\" frameborder=\"0\" allowtransparency=\"true\" title=\"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help\" src='javascript:\"\"' style=\"width: 100%; height: 152px; display: block;\"></iframe>
<!DOCTYPE html><html style=\"overflow-y: hidden;\"><head><style id=\"mceDefaultStyles\" type=\"text/css\">.mce-content-body div.mce-resizehandle {position: absolute;border: 1px solid black;background: #FFF;width: 7px;height: 7px;z-index: 10000}.mce-content-body .mce-resizehandle:hover {background: #000}.mce-content-body *[data-mce-selected] {outline: 1px solid black;resize: none}.mce-content-body .mce-clonedresizable {position: absolute;outline: 1px dashed black;opacity: .5;filter: alpha(opacity=50);z-index: 10000}.mce-content-body .mce-resize-helper {background: #555;background: rgba(0,0,0,0.75);border-radius: 3px;border: 1px;color: white;display: none;font-family: sans-serif;font-size: 12px;white-space: nowrap;line-height: 14px;margin: 5px 10px;padding: 5px;position: absolute;z-index: 10001}
.mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}
.mce-content-body .mce-offscreen-selection {position: absolute;left: -9999999999px;width: 100pxheight: 100px}.mce-content-body *[contentEditable=false] {cursor: default;}.mce-content-body *[contentEditable=true] {cursor: text;}
</style><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link type=\"text/css\" rel=\"stylesheet\" href=\"http://localhost:1344/PlugIns/tinymce/skins/lightgray/content.min.css\"></head><body id=\"tinymce\" class=\"mce-content-body \" data-id=\"Text\" contenteditable=\"true\" spellcheck=\"false\" style=\"overflow-y: hidden; padding-left: 1px; padding-right: 1px; padding-bottom: 50px;\" data-mce-style=\"overflow-y: auto; padding-left: 1px; padding-right: 1px; padding-bottom: 50px;\"><p>&nbsp;textarea is here</p></body></html>
// SNIPPET:
<form id=\"myForm\">
<strong>Loan: <input type=\"text\" name=\"loan\" id=\"loan\" value=\"\" size=\"10\"></strong>&nbsp;&nbsp;
<select id=\"duration\" onclick=\"onSelectChange(this)\" style=\"width: 85px\">
<option value=\" \"></option>
<option value=\"three\">3 years</option>
<option value=\"five\">5 years</option>
<option value=\"six\">6 years</option>
</select> &nbsp;&nbsp;
<strong>Interest: <input type=\"text\" name=\"interest\" id=\"interest\" value=\"\" size=\"10\"></strong>
<button type=\"button\" onclick=\"find_amount();\">Submit</button></br></br>
<strong>Total amount to be returned: <input type=\"text\" name=\"return\" id=\"return\" value=\"\" size=\"10\"></strong></br></br>
<strong>Installments</strong>
<select id=\"installments\" onclick=\"onSelectChange(this)\" style=\"width: 85px\">
<option value=\" \"></option>
<option value=\"year\">per year</option>
<option value=\"month\">per month</option>
<option value=\"week\">per week</option>
<option value=\"day\">per day</option>
</select> &nbsp;&nbsp;<strong>:</strong>
<span id=\"final\"></span>
</form>
// SNIPPET:
function onSelectChange(combo) {
switch (combo.value) {
case \"three\":
{
document.getElementById(\"interest\").value = \" 3% \";
break;
}
case \"five\":
{
document.getElementById(\"interest\").value = \" 5% \";
break;
}
case \"six\":
{
document.getElementById(\"interest\").value = \" 6% \";
break;
}
case \" \":
{
document.getElementById(\"interest\").value = \" \";
break;
}
}
function find_amount() {
var total;
var inter;
var lo;
lo = document.getElementById(\"loan\").value;
inter = document.getElementById(\"interest\").value;
total = (lo * inter) / 100;
alert(total);
//document.getElementById(\"return\").value = total;
}
}
// SNIPPET:
function InsertEmailMessage() {
$explode_check=explode(',', $_POST['ticked']);
//print_r($explode_check);
for($i=0;$i<count($explode_check);$i++)
{
$Selcheckb=$explode_check[$i];
$sql6 = \"SELECT * FROM invalid_invoice WHERE ID='\".$Selcheckb.\"'\";
$conn = dbConnect();
$stmt6 = $conn->prepare($sql6);
//$stmt6->bindParam(':id6', $_POST['idtxt'], PDO::PARAM_INT);
$stmt6->execute();
$data = $stmt6->fetchAll(PDO::FETCH_ASSOC);
//var_dump($data);
foreach ($data as $row6) {
$invnumb=$row6['Invoice_Number'];
$partnumb=$row6['Part_Number'];
$issue=$row6['Issues'];
$pic=$row6['PIC_Comments'];
$emailadd= $row6['PersoninCharge'];
$issuetype=$row6['Issue_Type'];
$createdate=$row6['Creation_Date'];
$site=$row6['Site'];
$vendor=$row6['Vendor_Name'];
$invdate=$row6['Invoice_Date'];
$po=$row6['PO'];
$rr=$row6['RR'];
$currency=$row6['Currency'];
$invamount=$row6['Invoice_Amount'];
$stat=$row6['Status'];
if($row6['Status']==\"Open\") {
$message = \"<html><b>Issue Type: {$issuetype} </b><br><br>\";
$message .= \"<b>Creation Date: {$createdate} </b><br><br>\";
$message .= \"<b>Site: {$site} </b><br><br>\";
$message .= \"<b>Vendor Name: {$vendor} </b><br><br>\";
$message .= \"<b>Invoice Date: {$invdate} </b><br><br>\";
$message .= \"<b>Invoice Number: {$invnumb} </b><br><br>\";
$message .= \"<b>Part Number:</b><br>{$partnumb}<br><br>\";
$message .= \"<b>PO: {$po} </b><br><br>\";
$message .= \"<b>RR: {$rr} </b><br><br>\";
$message .= \"<b>Currency: {$currency} </b><br><br>\";
$message .= \"<b>Invoice Amount: {$invamount} </b><br><br>\";
$message .= \"<b>Issues:</b><br>{$issue}<br>\";
$message .= \"<b>Status: {$stat} </b><br><br>\";
$message .= \"<b>{$pic}<b><br>\";
$message .= \"</html>\";
}
if(!empty($emailadd)) {
dbInsertEmailMessage($emailadd, \"Invoice Number: {$invnumb} - {$issue}.\", $message);
echo \"<script language='javascript'>alert('Email sent to {$emailadd}.')</script>\";
}
}
}
$conn=null;
}
function dbInsertEmailMessage($send_to, $subject, $message) {
$sql7 = \"INSERT INTO email_queue (send_to, subject, message) VALUES (:send_to, :subject, :message)\";
$conn = dbConnect();
$stmt7 = $conn->prepare($sql7);
$stmt7->bindParam(':send_to', $send_to);
$stmt7->bindParam(':subject', $subject);
$stmt7->bindParam(':message', $message);
$stmt7->execute();
$conn=null;
}
// SNIPPET:
a
// SNIPPET:
b
// SNIPPET:
<div class=\"parent\">
<div class=\"el-a\">
<a href=\"#\" onMouseOver=\"clicksound.playclip()\">1</a>
</div>
<div class=\"el-b\">
<a href=\"#\">2</a>
</div>
</div>
// SNIPPET:
/* LOGO SUPERIOR */
.el-a {
width:352px;
height:115px}
.el-b {
opacity: 0;
width:352px;
height:115px;
}
// SNIPPET:
$(document).ready(function() {
$(\".el-b\").hide();
$(\".el-a\").on(\"mouseover\", function() {
$(\".el-b\").show();
$(this).hide();
}).on(\"mouseout\", function() {
$(\".el-b\").hide();
$(this).show();
});
});
// SNIPPET:
//make a new file-uploader
var uploader = $scope.uploader = new FileUploader();
// upload function
$scope.uploadThis = function(item){
$timeout(function() {
//Getting my sign key with dpd-s3
dpd.bucket.get(item.file.name, {
signedUrl: 'Put',
ContentType: item.file.type
}, function(signedUrl, err){
//Setting my sign url and uploading
item.url= signedUrl;
item.upload();
})
})
}
// SNIPPET:
<table class=\"table b-a b-solid bg-white\">
<thead>
<tr>
<th>Fil</th>
</tr>
</thead>
<tbody>
<tr ng-repeat=\"item in uploader.queue\" class=\"text-sm\">
<td><strong>{{ item.file.name }}</strong></td>
<td nowrap>
<button type=\"button\" class=\"btn btn-default btn-xs\" ng-click=\"uploadThis(item)\" ng-disabled=\"item.isReady || item.isUploading || item.isSuccess\">
<span class=\"fa fa-upload\"></span> Upload
</button>
</td>
</tr>
</tbody>
</table>
// SNIPPET:
var arr = [
['First', 'lorem ipsum'],
['Second', 'dolor sit amet'],
];
// SNIPPET:
arr[0]
// SNIPPET:
for (var i = 0; i < markers.length; i++) {
var arr = markers[i];
var marker = new google.maps.Marker({
map: map,
if(arr[0] == 'Lorem') {
icon: 'http://imgur.com/1.png',
}
else {
icon: 'http://imgur.com/2.png',
}
});
var contentString = '';
google.maps.event.addListener(marker, \"click\", function () {
infowindow.setContent(this.html);
infowindow.open(map, this);
});
}
// SNIPPET:
<label>Enter address of a page you want me to visit</label><input type=\"text\" id=\"pageAddress\">
// SNIPPET:
(function(){
document.location =
'data:text/attachment;base64,' +
utf8_to_b64(document.documentElement.innerHTML); //To Download Entire Html Source
})();
function utf8_to_b64( str ) {
return window.btoa(unescape(encodeURIComponent( str )));
}
// SNIPPET:
db = connect(\"localhost:27017/test\");
var cursor=db.test.find();
cursor.forEach(
function(doc){
print(doc.name);
}
);
// SNIPPET:
load(\"mongo.js\")
// SNIPPET:
mongo.exe --quiet mongo.js > file.txt
mongo.js > file.txt
// SNIPPET:
// Creates values or objects on demand
angular.module(\"myApp\") // Get the \"myApp\" module created into the root.js file (into this module is injected the \"serviceModule\" service
.value(\"testValue\", \"AngularJS Udemy\")
// Define a factory named \"courseFactory\" in which is injected the testValue
.factory(\"courseFactory\", function(testValue) {
// The factory create a \"courseFactory\" JSON object;
var courseFactory = {
'courseName': testValue, // Injected value
'author': 'Tuna Tore',
getCourse: function(){ // A function is a valid field of a JSON object
alert('Course: ' + this.courseName); // Also the call of another function
}
};
return courseFactory; // Return the created JSON object
})
// Controller named \"factoryController\" in which is injected the $scope service and the \"courseFactory\" factory:
.controller(\"factoryController\", function($scope, courseFactory) {
alert(courseFactory.courseName); // When the view is shown first show a popupr retrieving the courseName form the factory
$scope.courseName = courseFactory.courseName;
console.log(courseFactory.courseName);
courseFactory.getCourse(); // Cause the second alert message
});
// SNIPPET:
<div ng-controller=\"factoryController\">
{{ courseName }}
</div>
// SNIPPET:
alert(courseFactory.courseName);
// SNIPPET:
.factory(\"courseFactory\", function(testValue)
// SNIPPET:
$scope.courseName = courseFactory.courseName;
// SNIPPET:
555.555.55,55
555.555.55,50 /* Note te extra zero */
// SNIPPET:
new Intl.NumberFormat(\"es-ES\").format(current.toFixed(2));
// SNIPPET:
555.555.55,5
// SNIPPET:
while loop
// SNIPPET:
while loop
// SNIPPET:
http://img7.italian.uk/pastaimages/6253.jpg
// SNIPPET:
http://img7.italian.uk/pastaimages/4218.jpg
// SNIPPET:
http://img7.italian.uk/pastaimages/7657.jpg
// SNIPPET:
http://img7.italian.uk/pastaimages/*
// SNIPPET:
http://img7.italian.uk/pastaimages/6253.jpg
// SNIPPET:
http://img7.italian.uk/pastaimages/*
// SNIPPET:
while (// 1st image === 6253) {
//refresh the current page
}
// once 1st image is no longer 6253, stop the loop and
// click the current first picture that ends with something like 3585, 8291 etc.
// SNIPPET:
var open = require(\"open\");
open('127.0.0.1:1337');
// SNIPPET:
var myArray = [
{
id: \"firstObject\",
func: function() {
console.log(\"Hi from function!\");
}
}
];
exports myArray = myArray;
// SNIPPET:
var {myArray} = require(\"./array.js\");
for (var i = 0; i < myArray.length; i++) {
self.port.emit(\"someEvent\", myArray[i]);
}
// SNIPPET:
id
// SNIPPET:
func
// SNIPPET:
func
// SNIPPET:
<script type=\"text/javascript\">
$(document).ready(function () {
function InfiniteScroll() {
$('#divPostsLoader').html('<img src=\"img/loader.gif\">');
$.ajax({
type: \"POST\",
url: \"Home.aspx/GetLastArticles\",
data: \"{}\",
contentType: \"application/json; charset=utf-8\",
dataType: \"json\",
success: function (data) {
if (data != \"\") {
$('#divPostsLoader:last').after(data.d);
}
$('#divPostsLoader').empty();
},
error: function (data) {
if (!document.getElementById('#divPostsLoader').innerHTML == \"<p>END OF POSTS</p>\")
$('#divPostsLoader').empty();
$('#divPostsLoader').html(\"<p>END OF POSTS</p>\");
}
})
};
var b = false;
//When scroll down, the scroller is at the bottom with the function below and fire the lastPostFunc function
$(window).scroll(function () {
if ($(document).height() <= $(window).scrollTop() + $(window).height()) {
InfiniteScroll();
}
b = true;
});
if (!b) {
window.onload = function () {
InfiniteScroll();
};
}
});
</script>
// SNIPPET:
GetLastArticles
// SNIPPET:
<script type=\"text/javascript\">
$(\".tag_button\").on('click', function (e) {
e.preventDefault(); // prevent default action - hash doesn't appear in url
$(this).parent().find('div').toggleClass('tags-active');
$(this).parent().toggleClass('child');
});
</script>
// SNIPPET:
<div class=\"tags_list\">
<a class=\"tag-icon tag_button\" href=\"#\" >Tags</a>
<div class=\"tags\">
<a class=\"tag-icon\" href=\"#\" >Tag1</a>
<a class=\"tag-icon\" href=\"#\">Tag2</a>
<a class=\"tag-icon\" href=\"#\">Tag3</a>
<a class=\"tag-icon\" href=\"#\">Tag4</a>
<a class=\"tag-icon\" href=\"#\">Tag5</a>
<a class=\"tag-icon\" href=\"#\">Tag6</a>
<a class=\"tag-icon\" href=\"#\">Tag7</a>
</div>
</div>
// SNIPPET:
function doA(){ /* do A */};
function doB(){ /* do B */};
function doC(){ /* do C */};
// SNIPPET:
var funcs=[];
funcs.push(doA);
funcs.push(doB);
funcs.push(doC);
$(window).on(\"resize\", function(){
for(var i=0; i<funcs.length; i++){
funcs[i]();
}
});
// SNIPPET:
$(window).on(\"resize\", doA);
$(window).on(\"resize\", doB);
$(window).on(\"resize\", doC);
// SNIPPET:
function quantity_change(way, id){
quantity = $('#product_amount_'+id).val();
if(way=='up'){
quantity++;
} else {
quantity--;
}
if(quantity<1){
quantity = 1;
}
if(quantity>10){
quantity = 10;
}
$('#product_amount_'+id).val(quantity);
}
// SNIPPET:
//row 1
<div class=\"amount\"><input type=\"text\" name=\"quantity\" value=\"1\" id=\"product_amount_1234\"/></div>
<div class=\"change\" data-id=\"1234\">
<a href=\"javascript:;\" onclick=\"quantity_change('up');\" title=\"+\" class=\"up\">+</a>
<a href=\"javascript:;\" onclick=\"quantity_change('down');\" title=\"-\" class=\"down\">-</a>
</div>
//row 2
<div class=\"amount\"><input type=\"text\" name=\"quantity\" value=\"1\" id=\"product_amount_4321\"/></div>
<div class=\"change\" data-id=\"4321\">
<a href=\"javascript:;\" onclick=\"quantity_change('up');\" title=\"+\" class=\"up\">+</a>
<a href=\"javascript:;\" onclick=\"quantity_change('down');\" title=\"-\" class=\"down\">-</a>
</div>
// SNIPPET:
$(document).ready(function(){
$('.change a').click(function(){
var id = $(this).find('.change').data('id');
quantity_change(id)
});
});
// SNIPPET:
<?xml version='1.0' encoding='UTF-8'?>
// SNIPPET:
<td onclick=\"showMap('{{ parcours.kml|raw }}')\">test</td>
// SNIPPET:
<!-- send to api link and return ip -->
function myIP()
{
if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();
else xmlhttp = new ActiveXObject(\"Microsoft.XMLHTTP\");
xmlhttp.open(\"GET\",\"http://api.hostip.info/get_html.php\",false);
xmlhttp.send();
hostipInfo = xmlhttp.responseText.split(\"\\n\");
for (i=0; hostipInfo.length >= i; i++)
{
ipAddress = hostipInfo[i].split(\":\");
if ( ipAddress[0] == \"IP\" )
{
return ipAddress[1];
}
}
return false;
}
// SNIPPET:
a = {
get p() {
alert(1)
}
};
alert(a.p);
// SNIPPET:
1
// SNIPPET:
undefined
// SNIPPET:
a = {
set p(x) {
alert(x)
}
};
alert(a.p);
// SNIPPET:
a = {
get p() {
alert(1)
}
}
and
a = {
set p(x) {
alert(x)
}
};
// SNIPPET:
HTMLElement.onclick = somefunction;
// SNIPPET:
HTMLElement.removeEventListener('click', somefunction)
// SNIPPET:
$scope.loadEvents = function () {
$scope.calendar.eventSource = getEvents();
};
//I replaced CreateRandomEvents() with getEvents().
function getEvents(object){
TimeSlotsModel.all()
.then(function (result) {
vm.data = result.data.data;
var events = [];
angular.forEach(vm.data, function(value,key) {
var eventName = value.name;
var startDate = new Date(value.startDate);
var endDate = new Date(value.endDate);
var selectedStartingTime =new Date(value.startTime * 1000 );
var selectedEndingTime = new Date(value.endTime * 1000);
//timing is not right, needs fixing
startTime = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate(),selectedStartingTime.getHours(), selectedStartingTime.getUTCMinutes());
endTime = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate(),selectedEndingTime.getUTCHours(), selectedEndingTime.getUTCMinutes());
// console.log(startTime);
events.push({
title: 'Event -' + eventName,
startTime: startTime,
endTime: endTime,
allDay: false
});
console.log(events);
console.log(value);
//value is the object!!
})
return events;
})
}
// SNIPPET:
function createRandomEvents() {
var events = [];
for (var i = 0; i < 20; i += 1) {
var date = new Date(); //(if not parameters are passed through, Date(); returns today's date)
var eventType = Math.floor(Math.random() * 2);
var startDay = Math.floor(Math.random() * 90) - 45;
var endDay = Math.floor(Math.random() * 2) + startDay;
var startTime;
var endTime;
if (eventType === 0) {
startTime = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate() + startDay));
if (endDay === startDay) {
endDay += 1;
}
endTime = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate() + endDay));
events.push({
title: 'All Day - ' + i,
startTime: startTime,
endTime: endTime,
allDay: true
});
} else {
var startMinute = Math.floor(Math.random() * 24 * 60);
var endMinute = Math.floor(Math.random() * 180) + startMinute;
startTime = new Date(date.getFullYear(), date.getMonth(), date.getDate() + startDay, 0, date.getMinutes() + startMinute);
endTime = new Date(date.getFullYear(), date.getMonth(), date.getDate() + endDay, 0, date.getMinutes() + endMinute);
events.push({
title: 'Event - ' + i,
startTime: startTime,
endTime: endTime,
allDay: false
});
}
}
return events;
}
})
// SNIPPET:
<ion-view view-title={{viewTitle}} >
<ion-nav-buttons side=\"right\">
<button class=\"button \" ng-disabled=\"isToday()\" ng-click=\"today()\">Today</button>
<button class=\"button\" ng-click=\"changeMode('month')\">M</button>
<button class=\"button\" ng-click=\"changeMode('week')\">W</button>
<button class=\"button\" ng-click=\"changeMode('day')\">D</button>
<button class=\"button\" ng-click=\"loadEvents()\">Load Events</button>
</ion-nav-buttons>
<ion-content scroll=\"false\" class=\"main-content \">
<!-- <ion-header-bar align-title=\"left\" class=\"bar-positive\">
{{viewTitle}} -->
<calendar ng-model=\"calendar.currentDate\"
calendar-mode=\"calendar.mode\"
event-source=\"calendar.eventSource\"
show-weeks=\"calendar.showWeeks\"
range-changed=\"reloadSource(startTime, endTime)\"
event-selected=\"onEventSelected(event)\"
title-changed=\"onViewTitleChanged(title)\"
time-selected=\"onTimeSelected(selectedTime)\"
></calendar>
</ion-content>
</ion-view>
</div>
</ion-content>
</ion-view>
// SNIPPET:
data:
monthArray
(
[0] => Array
(
[Name] => abc
[total_point] => 100
[total_earn_point] => 0
)
)
weekArray
(
[0] => Array
(
[Name] => xyz
[total_point] => 100
[total_earn_point] => 0
)
)
// SNIPPET:
function emp_perf(){
jQuery.ajax({
url: \"<?php echo base_url(); ?>grade_tasks/emp_performance\",
data:'',
type:\"GET\",
success:function(data){
alert(data[0]);
},
error:function (){}
});
}
setInterval(emp_perf, 3000);
// SNIPPET:
<%@page import=\"java.sql.ResultSet\"%>
<%@page import=\"java.sql.Statement\"%>
<%@page import=\"java.sql.Connection\"%>
<%@page import=\"java.util.ArrayList\"%>
<%@ page language=\"java\" contentType=\"text/html; charset=ISO-8859-1\"
pageEncoding=\"ISO-8859-1\"%>
<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html lang=\"en\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">
<title>Insert title here</title>
<link rel=\"stylesheet\"
href=\"http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\">
<script
src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js\"></script>
<script
src=\"http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js\"></script>
<script type=\"text/javascript\"
src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js\"></script>
<%
String loginIdEdit = \"\";
%>
**<script>
$(function() {
//twitter bootstrap script
$(\"button#save\").click(function(e) {
$.ajax({
type : \"POST\",
url : \"defaulterUpdater.jsp\",
data : $('form.contact').serialize(),
success : function(msg) {
},
error : function() {
alert(\"Failed\");
}
});
});
});
</script>**
<script type=\"text/javascript\">
function myFun() {
alert(\"welcome\");
var demo = document.createElement('div');
demo.innerHTML = demo.innerHTML
+ \"<tr><input type='text' name='mytext'><tr>\";
}
</script>
</head>
<body>
<div class=\"container\">
<form method=\"post\" action=\"RegistrationServlet\">
<%
response.setHeader(\"Cache-Control\", \"no-cache\");
response.setHeader(\"Cache-Control\", \"no-store\");
response.setHeader(\"Pragma\", \"no-cache\");
response.setDateHeader(\"Expires\", 0);
Connection con = null;
con = DBManager.getConnection();
Statement st = con.createStatement();
String userName = \"\";
ArrayList<AutoDefaulterVO> defaulterList = null;
HttpSession session2 = request.getSession();
if (session2.getAttribute(\"first_name\") == null) {
out.println(\"Your session expired.....\");
%>
<a href=\"Home.jsp\">Please Login Again to continue</a>
<%
} else {
defaulterList = (ArrayList<AutoDefaulterVO>) session2
.getAttribute(\"autoDefaulterList\");
userName = session2.getAttribute(\"first_name\").toString();
%>
<form action='LogoutServlet' method=POST>
<table align=\"right\" style=\"width: 100%\">
<tr>
<td align=\"left\"><input type=\"submit\" name=\"logout\"
value=\"Home\" onclick=\"form.action='AdminHome';\">
</td>
<td align=\"right\"><input type=\"submit\" name=\"logout\"
value=\"Logout\" onclick=\"form.action='LogoutServlet'\">
</td>
</tr>
</table>
</form>
<h3 align=\"center\">Auto Defaults</h3>
<table border=\"1\" style=\"width: 100%\">
<br>
<br>
<h3 align=\"center\">
Welcome
<%=userName%></h3>
<table border=\"1\" style=\"width: 100%\" class=\"table table-hover\">
<tr>
<th>Default Status</th>
<th>Borrower Name</th>
<th>Borrower Rating</th>
<th>Accural Status</th>
<th>Bank Number</th>
<th>Account Number</th>
<th>Days Past Due</th>
<th>Comments</th>
</tr>
<%
for (int i = 0; i < defaulterList.size(); i++) {
AutoDefaulterVO defaulter = new AutoDefaulterVO();
defaulter = defaulterList.get(i);
loginIdEdit = defaulter.getDefaulterLoginID();
System.out.println(\"Printing only auto defaulter in jsp \");
%>
<tr>
<%-- <td><%=defaulter.getDefaultStatus()%></td> --%>
<td>Auto Defaulter</td>
<td><%=defaulter.getBorrowerName()%></td>
<td><%=defaulter.getBorrowerRating()%></td>
<td><%=defaulter.getAccuralStatus()%></td>
<td><%=defaulter.getBankNumber()%></td>
<td><%=defaulter.getAccountNumber()%></td>
<td><%=defaulter.getDaysPastDue()%></td>
<%-- <td><%=loginIdEdit%></td> --%>
<td>
<%
ResultSet rs = st
.executeQuery(\"select * from aip_comments\");
while (rs.next()) {
System.out.println(\"Auto defaulter loginId printing-->\"
+ defaulter.getDefaulterLoginID());
String loginId = rs.getString(\"login_id\");
System.out.println(\"databse loginId printing-->\"
+ rs.getString(\"login_id\"));
if (defaulter.getDefaulterLoginID().equals(
rs.getString(\"login_id\"))) {
%> <%=rs.getString(\"comments\")%> <%
}
}
%>
</td>
<td>
<!-- <form name=\"editForm\" action=\"edit.jsp\">
<button type=\"button\" data-toggle=\"modal\" class=\"btn btn-default\" data-target=\"#myModal\">Edit</button>
-->
<form class=\"contact\">
<button href=\"#edit-modal\" type=\"button\" data-toggle=\"modal\"
class=\"btn btn-default\" data-target=\"#<%=loginIdEdit %>\">Edit</button>
<!-- <a data-toggle=\"modal\" data-target=\"#<%=loginIdEdit%>\" href=\"#\">Edit</a> -->
<!-- <input type=\"submit\" name=\"editButton\" value=\"Edit\"> -->
<!--<input type=\"hidden\" id=\"edit\" name=\"edit\" value=\"<%=loginIdEdit%>\" />-->
</td>
<div class=\"modal fade\" id=\"<%=loginIdEdit%>\" role=\"dialog\">
<div class=\"modal-dialog\">
<div class=\"modal-content\">
<div class=\"modal-header\">
<button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;</button>
<h4 class=\"modal-title\">
Edit status and add comment for
<%=defaulter.getBorrowerName()%></h4>
</div>
<div class=\"modal-body\">
<div class=\"form-group\">
<label for=\"sel1\"><span></span>Select status:</label> <select
class=\"form-control\" id=\"sel1\" name=\"sel1\">
<option>Validate Error</option>
<option>Auto Weaver</option>
<option>ReDefault</option>
</select>
</div>
<div class=\"form-group\">
<label for=\"defaultercomment\"><span></span>Add
comment:</label> <input type=\"text\" class=\"form-control\"
name=\"defaultercomment\" id=\"defaultercomment\"<%-- value=\"<%=loginIdEdit%>\" --%>>
</div>
</div>
<div class=\"modal-footer\">
<button type=\"button\" id=\"save\" name=\"save\"
class=\"btn btn-default\" data-dismiss=\"modal\" align=\"centre\">Done</button>
</div>
</div>
</div>
</div>
</form>
<%
}
%>
</tr>
</table>
<%
}
%>
</body>
</html>
// SNIPPET:
<%@ page language=\"java\" contentType=\"text/html; charset=ISO-8859-1\"
pageEncoding=\"ISO-8859-1\"%>
<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">
<title>Insert title here</title>
</head>
<body>
<% String selection = request.getParameter(\"sel1\");
String comment = request.getParameter(\"defaultercomment\");
System.out.println(\"selection-\"+selection+\"comment--\"+comment);
%>
</body>
</html>
// SNIPPET:
function createActions() {
var actions = []
var action1 = {command:'buy', qty:100, symbol:'S', price:3.50}
var self = this
action1.afterwards = function() {
self.setStopAndTarget()
}
actions.push(action1)
// add some more actions
return actions
}
// SNIPPET:
Promise.method(function checkForTrades() {
var actions = generic.createActions()
actions.forEach(function(a) {
if( a.command === 'buy' ) {
buyStock(a.symbol, a.qty, q.price).then(function(a) {
if( a.afterwards ) {
a.afterwards()
}
})
}
})
})
// SNIPPET:
createActions()
// SNIPPET:
actions
// SNIPPET:
action
// SNIPPET:
afterwards
// SNIPPET:
actions
// SNIPPET:
action
// SNIPPET:
Promise
// SNIPPET:
afterwards
// SNIPPET:
then()
// SNIPPET:
afterwards
// SNIPPET:
action
// SNIPPET:
afterwards
// SNIPPET:
action
// SNIPPET:
then()
// SNIPPET:
Promises.all
// SNIPPET:
paper-slider
// SNIPPET:
<dom-module id=\"my-slider\">
<template>
<style>
/* Works */
paper-slider {
--paper-slider-active-color: red;
--paper-slider-knob-color: red;
--paper-slider-height: 3px;
}
/* Doesn't work */
paper-slider #sliderContainer.paper-slider {
margin-left: 0;
}
/* Also doesn't work */
.slider-input {
width: 100px;
}
</style>
<div>
<paper-slider editable$=\"[[editable]]\" disabled$=\"[[disabled]]\" value=\"{{value}}\" min=\"{{min}}\" max=\"{{max}}\"></paper-slider>
</div>
</template>
<script>
Polymer({
is: \"my-slider\",
properties: {
value: {
type: Number,
value: 0,
reflectToAttribute: true
},
min: {
type: Number,
value: 0
},
max: {
type: Number,
value: 100
},
editable: Boolean,
disabled: Boolean
}
});
</script>
</dom-module>
// SNIPPET:
paper-slider
// SNIPPET:
paper-slider
// SNIPPET:
toastr.warning(\"Cynthia Open Chat and respond to request\",\"\",{\"timeOut\":5000,\"progressBar\":true,})
// SNIPPET:
Cynthia G. Open Chat and respond to request
// SNIPPET:
/\\w.*(?=\"\\w){1}/
// SNIPPET:
.each()
// SNIPPET:
$('.thing').each(function(i, obj) {
var elemText = $(obj).clone().children().remove().end().text();
$('body').append(elemText);
})
// SNIPPET:
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>
<div class=\"thing\">
Parent
<div class=\"thing\">
Child
</div>
</div>
<hr/>
<h3>Output:</h3>
// SNIPPET:
function getChartByTitle(titleString) {
var allCharts = Highcharts.charts;
// 1. for each chart, get options
// 2. look up the \"title\" attribute in the options
// 3. if matches `titleString`, return current chart
}
// SNIPPET:
{
id1: value1,
id2: value2
id3: value3,
...
}
// SNIPPET:
[
{ id: 'id1', value: 'value1' },
{ id: 'id2', value: 'value2' },
{ id: 'id3', value: 'value3' },
...
]
// SNIPPET:
http://www.thisissample.com/
// SNIPPET:
https://www.google.com.my/
// SNIPPET:
else if (startID >= 58 && startID <= 63){ // bottom row
if (endID == startID - 7 || endID == startID - 8 || endID == startID - 9 || endID == startID - 1 || endID == startID + 1) return true;
}
// SNIPPET:
endID == startID + 1
// SNIPPET:
fileTransfer.download(
uri,
'cdvfile://localhost/persistent/uploads.zip',
function(entry) {
zip.unzip(entry.toURL(), 'cdvfile://localhost/persistent/uploads', function(data){
if(data !== 0){
alert('KO');
}else{
alert('Success');
}
}, progressCallback);
}, ...
// SNIPPET:
Unhandled rejection SequelizeConnectionError: Login failed for user 'EventAdmin'.
// SNIPPET:
language: node_js
node_js:
- \"4.1\"
- \"4.0\"
- \"0.12\"
- \"0.11\"
- \"0.10\"
- \"iojs\"
before_install:
- npm install -g grunt-cli
script: grunt test
// SNIPPET:
'use strict';
var chai = require('chai');
var expect = chai.expect;
var assert = chai.assert;
var chaihttp = require('chai-http');
chai.use(chaihttp);
require('../server.js');
describe('Test /showfullteam route', function() {
it('should load all MS contacts from /showfullteam', function(done) {
chai.request('localhost:3000')
.get('/showfullteam')
.end(function(err, res) {
expect(err).to.eql(null);
for (var i = 0; i < res.body.length; i++) {
expect(res.body[i]).to.include.keys('firstName', 'lastName', 'email', 'newsletterSubscription', 'contactDescription', 'msTeamMember', 'msTeamTitle', 'showOnHomePage', 'headShot', 'company', 'address', 'country', 'interestId', 'allowNotifications', 'allowPersonalInfoSharing');
expect(res.body[i].msTeamMember).to.eql(true);
expect(typeof res.body[i].firstName).to.be.a('string') || expect(typeof res.body[i].firstName).to.be.a('null');
expect(typeof res.body[i].lastName).to.be.a('string') || expect(typeof res.body[i].firstName).to.be.a('null');
expect(typeof res.body[i].email).to.be.a('string') || expect(typeof res.body[i].firstName).to.be.a('null');
if (res.body[i].newsletterSubscription) {
assert.typeOf(res.body[i].newsletterSubscription, 'boolean');
}
if (res.body[i].msTeamMember) {
assert.typeOf(res.body[i].msTeamMember, 'boolean');
}
if (res.body[i].showOnHomePage) {
assert.typeOf(res.body[i].showOnHomePage, 'boolean');
}
if (res.body[i].allowNotifications) {
assert.typeOf(res.body[i].allowNotifications, 'boolean');
}
if (res.body[i].interestId) {
assert.isNumber(res.body[i].interestId);
}
expect(typeof res.body[i].contactDescription).to.be.a('string') || expect(typeof res.body[i].firstName).to.be.a('null');
expect(typeof res.body[i].headShot).to.be.a('string') || expect(typeof res.body[i].firstName).to.be.a('null');
expect(typeof res.body[i].company).to.be.a('string') || expect(typeof res.body[i].firstName).to.be.a('null');
expect(typeof res.body[i].address).to.be.a('string') || expect(typeof res.body[i].firstName).to.be.a('null');
expect(typeof res.body[i].country).to.be.a('string') || expect(typeof res.body[i].firstName).to.be.a('null');
expect(typeof res.body[i].allowPersonalInfoSharing).to.be.a('string') || expect(typeof res.body[i].firstName).to.be.a('null');
};
done();
});
});
});
// SNIPPET:
Controller
var la;
var lo;
var map;
function createMap() {
la= setLatitude();
lo= setLongitude();
var centerCoord = new google.maps.LatLng(la, lo); //dyanmic address through ajax
var mapOptions = {
zoom: 12,
center: centerCoord,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('User-Map'),mapOptions);
function sayHello(){alert('hahahhaha');}
}
function setLatitude(){
$.ajax({
url: 'geo-data',
type: 'POST',
dataType: 'JSON',
success: function (data) {
return data['latitude'];
}
});
}
function setLongitude(){
return 145.008062;
}
// SNIPPET:
function CThis(){
this.method= function() {
console.log(\"method of \",this);
};
}
function CProto(){
}
CProto.prototype.method = function() {
console.log(\"method of \",this);
};
window.onload = function(){
ct = new CThis();
ct.method();
cp = new CProto();
cp.method();
};
// SNIPPET:
\"method of \" Object { method: CThis/this.method() } oop.js:3:4
\"method of \" Object { } oop.js:11:2
// SNIPPET:
function CThis(){
this.localthis = \"I'm this.localthis\";
var localvar = \"I'm localvar\";
this.method= function() {
console.log(\"method of \",this);
console.log(\"value of this.localthis:\", this.localthis);
console.log(\"value of localvar with this.:\", this.localvar);
console.log(\"value of localvar without this.:\", localvar);
};
}
function CProto(){
this.localthis = \"I'm this.localthis\";
var localvar = \"I'm localvar\";
}
CProto.prototype.method = function() {
console.log(\"method of \",this);
console.log(\"value of this.localthis:\", this.localthis);
console.log(\"value of localvar with this.:\", this.localvar);
console.log(\"value of localvar without this.:\", localvar);
};
window.onload = function(){
ct = new CThis();
ct.method();
cp = new CProto();
cp.method();
};
// SNIPPET:
method of \" Object { localthis: \"I'm this.localthis\", method: CThis/this.method() } oop.js:5:4
\"value of this.localthis:\" \"I'm this.localthis\" oop.js:6:4
\"value of localvar with this.:\" undefined oop.js:7:4
\"value of localvar without this.:\" \"I'm localvar\" oop.js:8:4
\"method of \" Object { localthis: \"I'm this.localthis\" } oop.js:18:2
\"value of this.localthis:\" \"I'm this.localthis\" oop.js:19:2
\"value of localvar with this.:\" undefined oop.js:20:2
ReferenceError: localvar is not defined
// SNIPPET:
leadsService.getLeadFileContent(item.upload_name, function (data) {
var url = \"\" + data;
var type = '';
if (item.name.toLowerCase().indexOf('.png')) {
type = 'image/png';
}
else if (item.name.toLowerCase().indexOf('.pdf')) {
type = 'application/pdf';
}
else if (item.name.toLowerCase().indexOf('.doc')) {
type = 'application/msword';
}
else if (item.name.toLowerCase().indexOf('.txt')) {
type = 'application/txt';
}
else if (fileName.toLowerCase().indexOf('.xls')) {
type = 'application/xls';
}
var newTab = $window.open('about:blank', '_blank');
newTab.document.write(\"<object width='400' height='400' data='\" + url + \"' type='\" + type + \"' ></object>\");
});
// SNIPPET:
<p id=\"demo\" ></p>
<script>
var str = \"[website]\";
var n = str.length;
if (n === 0) {
alert(\"0\");
document.getElementById(\"demo\").innerHTML = \"Register Here\";
document.getElementById(\"demo\").setAttribute (\"href\", 'str');
}
else {alert(\"else\");}
</script>
// SNIPPET:
public string GetStartupScript()
{
StringBuilder str = new StringBuilder();
str.AppendFormat(\"$(\\\"#{0}\\\")\", this.ClientID);
str.Append(\".tabs({ beforeActivate: function(e,ui) {\");
str.Append(CustomJSInSelectedTab);
str.Append(GetSetSelectedTabIndexScript());
str.Append(\"}\");
str.Append(\"}\");
return str.ToString();
}
public string GetSetSelectedTabIndexScript()
{
StringBuilder script = new StringBuilder();
script.AppendFormat(\"SelectTab(ui.newPanel,'{0}');\", _hdnSelectedTabId.ClientID);
return script.ToString();
}
// SNIPPET:
SelectTab = function (newpanel, hdnIndexId) {
$(\"#\" + hdnIndexId).val($(newpanel.selector)[0].id);
}
// SNIPPET:
index.aspx
template.master
--Folder
// SNIPPET:
-img.jpg
// SNIPPET:
-pageInFolder.aspx
// SNIPPET:
var initColumns = [
{
id: 0,
Index: 0,
ResponsiveStyle: 3,
Widgets: []
},
{
id: 1,
Index: 1,
ResponsiveStyle: 3,
Widgets:[]
},
{
id: 2,
Index: 2,
ResponsiveStyle: 3,
Widgets: []
}
];
var Columns = new kendo.data.HierarchicalDataSource({
schema: {
data: \"Columns\"
}
});
var Rows = new kendo.data.HierarchicalDataSource({
schema: {
data: \"Rows\",
model: rowModel
}
});
var Widgets = new kendo.data.HierarchicalDataSource({
schema: {
data: \"Widgets\",
model: layoutWidgetModel
}
});
var layoutWidgetModel = kendo.data.Node.define({
id: \"layoutWidget\",
hasChildren: \"Rows\",
children: Rows
});
var rowModel = kendo.data.Node.define({
id: \"rowModel\",
hasChildren: \"Columns\",
children: Columns
});
var parentModel = kendo.data.Node.define({
id: \"parentModel\",
hasChildren: \"Widgets\",
children: Widgets
});
var validator;
var viewModel = kendo.observable({
//create a dataSource
dataSource: new kendo.data.HierarchicalDataSource({
data: initColumns,
schema: {
model: parentModel
}
}),
selected: {} //this field will contain the edited dataItem
});
viewModel.dataSource.read(); //invoke the read transport of the DataSource
//Create the variables to create an object for insertion into the main parent object for the HierarchicalDataSource
var Rows = [ { Index: 0, Columns: [
{
Index: 0,
ResponsiveStyle: 0
}]
} ];
var SubType = 'Joined';
var WidgetName = 'widget name';
var Type = 'widget type';
var DisplayType = 'widget subtype';
var Title = 'widget title';
var Collapsible = true;
var Borders = 1;
var TitleBackground = 4;
var TitleColour = 6;
var kendoLayoutWidget = new layoutWidgetModel({ Title: Title, Type: Type, SubType: SubType, WidgetName: WidgetName, Collapsible: Collapsible, DisplayType: DisplayType, Borders: Borders, TitleBackground: TitleBackground, TitleColour: TitleColour, Rows: Rows });
//Get the uid of the new widget
var GUID = kendoLayoutWidget.uid;
//Get the current object from the HierarchicalDataSource
var VBdata = viewModel.dataSource.data();
//Push in the newly created widget object
VBdata[0].Widgets.push(kendoLayoutWidget);
//Replace the old data in the dataSource with the new multilevel object
viewModel.dataSource.data(VBdata);
//find the layoutwidget by getByUid()
var theWidget = viewModel.dataSource.getByUid(GUID);
console.log(viewModel.dataSource);
console.log(GUID);
console.log(theWidget);
// SNIPPET:
REST API
// SNIPPET:
orderItem
// SNIPPET:
menu_modifier_groups
// SNIPPET:
menu_modifier_items
// SNIPPET:
orderItem
// SNIPPET:
menu_modifier_groups
// SNIPPET:
menu_modifier_items
// SNIPPET:
orderItem: {
id: 159
name: Empanadas (Choice of 2)
description: Choice of Diced Beef; Spinach, Stilton and Onion; or Smoked Ham and Mozzarella
price: 700
available: 1
created_at: 2016-01-31 16:50:31
updated_at: 2016-01-31 16:50:31
menu_category_id: 41
restaurant_id: 11
menu_modifier_groups:
[ {
id: 9
name: Choose 2 Empanadas
instruction: null
min_selection_points: 2
max_selection_points: 2
force_selection: 1
created_at: 2016-02-01 01:03:35
updated_at: 2016-02-01 01:12:23
menu_item_id: 159
restaurant_id: 11
menu_modifier_items:
[ {
id: 34
name: Diced Beef
price: 0
created_at: 2016-02-01 01:04:08
updated_at: 2016-02-01 01:04:08
menu_modifier_group_id: 9
restaurant_id: 11
menu_item_id: 159
selected: true
} , {
id: 35
name: Smoked Salmon & Mozzarella
price: 0
created_at: 2016-02-01 01:04:37
updated_at: 2016-02-01 01:04:37
menu_modifier_group_id: 9
restaurant_id: 11
menu_item_id: 159
selected: true
} , {
id: 36
name: Stilton, Spinach and Onion
price: 0
created_at: 2016-02-01 01:05:05
updated_at: 2016-02-01 01:05:05
menu_modifier_group_id: 9
restaurant_id: 11
menu_item_id: 159
selected: false
} ]
} ]
}
// SNIPPET:
REST API
// SNIPPET:
orderItem
// SNIPPET:
// the main item + menu_modifier_items(where selected = true) without menu_modifier_groups
$scope.mainItem =
{
id: 159
name: Empanadas (Choice of 2)
description: Choice of Diced Beef; Spinach, Stilton and Onion; or Smoked Ham and Mozzarella
price: 700
available: 1
created_at: 2016-01-31 16:50:31
updated_at: 2016-01-31 16:50:31
menu_category_id: 41
restaurant_id: 11
menu_modifier_items:
[ {
id: 34
name: Diced Beef
price: 0
created_at: 2016-02-01 01:04:08
updated_at: 2016-02-01 01:04:08
menu_modifier_group_id: 9
restaurant_id: 11
menu_item_id: 159
selected: true
} , {
id: 35
name: Smoked Salmon & Mozzarella
price: 0
created_at: 2016-02-01 01:04:37
updated_at: 2016-02-01 01:04:37
menu_modifier_group_id: 9
restaurant_id: 11
menu_item_id: 159
selected: true
} ]
}
// SNIPPET:
$http
// SNIPPET:
$scope.addItem = function(orderItem) {
//transform orderItem here into mainItem
$http({
method: 'post',
url: \"http://api.example.com/web/cart/item/add\",
data: $.param({
'cartItem': $scope.mainItem
}),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function (data, status, headers, config) {
});
}
// SNIPPET:
<div class=\"page\">
<a href=\"#image1\"><img src=\"http://www.planwallpaper.com/static/images/20-Amazing-and-Cool-Background-For-Desktop-13.jpg\" alt=\"\" style=\"width: 300px; height: auto; \" /></a>
</div>
<a href=\"#\" id=\"image1\" class=\"pressbox\"><img src=\"http://www.planwallpaper.com/static/images/20-Amazing-and-Cool-Background-For-Desktop-13.jpg\" style=\"width: 70%; max-height:90%; \" alt=\"\"></a>
// SNIPPET:
.page{
width: auto;
height: auto;
padding: 20px;
}
.pressbox {
width: 0;
height: 0;
position: fixed;
overflow: hidden;
left: 0;
top: 0;
z-index: 9999;
text-align: center;
background: rgba(0,0,0,0.7);
}
.pressbox img {
opacity: 0;
padding: 10px;
background: #ffffff;
margin-top: 100px;
-webkit-box-shadow: 0px 0px 15px #444;
-moz-box-shadow: 0px 0px 15px #444;
box-shadow: 0px 0px 15px #444;
-moz-transition: opacity .25s ease-in-out;
-webkit-transition: opacity .25s ease-in-out;
transition: opacity .25s ease-in-out;
}
.pressbox:target {
width: auto;
height: auto;
bottom: 0;
right: 0;
}
.pressbox:target img {
opacity: 1;
}
.page:target {
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
filter: blur(5px);
}
// SNIPPET:
//desktop
$(document).mouseup(function (e)
{
var container = $(\".messenger\");
if (!container.is(e.target) // if the target of the click isn't the container...
&& container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.empty();
container.off( 'click', clickDocument );
}
});
// Touch devices like IPAD and IPHONE we can use following code
$(document).on('touchstart', function (e) {
var container = $(\".messenger\");
if (!container.is(e.target) // if the target of the click isn't the container...
&& container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.empty();
container.off( 'click', clickDocument );
}
});
// SNIPPET:
<input type=\"text\" ng-model=\"test.name\" placeholder=\"start typing..\">
// SNIPPET:
<tr ng-repeat=\"x in names | filter:test | limitTo:totalDisplayed\">
<td>{{ x.name }}</td>
<td>{{ x.number}}</td>
<td>{{ x.city }}</td>
<td>{{ x.country }}</td>
</tr>
// SNIPPET:
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/css/side_file.css\">
<script type=\"text/javascript\" src=\"/static/js/parsley.js\"></script>
<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/css/side_file.css\">
<script type=\"text/javascript\" src=\"/static/js/parsley.js\"></script>
</head>
<body>
<form data-parsley-validate method=\"POST\">
{{form}}
</form>
</body>
// SNIPPET:
App.config(function ($httpProvider) {
$httpProvider.interceptors.push('authInterceptorService');
});
// SNIPPET:
var localStorageLocation = ngAuthSettings.localStorageLocation;
var authInterceptorServiceFactory = {};
var _request = function (config) {
config.headers = config.headers || {};
var authData = localStorageService.get(localStorageLocation);
if (authData) {
config.headers.Authorization = 'Bearer ' + authData.token;
}
return config;
}
authInterceptorServiceFactory.request = _request;
// SNIPPET:
$(document).ready(function(){
var snd = new Audio(\"images/new_msg.wav\");
var open=Array();
$(\"#jd-chat .jd-online_user\").click(function(){
var user_name = $.trim($(this).text());
var id = $.trim($(this).attr(\"id\"));
if($.inArray(id,open) !== -1 )
return
open.push(id);
$(\"#jd-chat\").prepend('<div class=\"jd-user\">\\
<div class=\"jd-header\" id=\"' + id + '\">' + user_name + '<span class=\"close-this\"> X </span></div>\\
<div class=\"jd-body\"></div>\\
<div class=\"jd-footer\"><input id=\"textareabox\" placeholder=\"escrever...\"></div>\\
</div>');
$.ajax({
url:'chat.class.php',
type:'POST',
data:'get_all_msg=true&user=' + id ,
success:function(data){
$(\"#jd-chat\").find(\".jd-user:first .jd-body\").append(\"<span style='display:block' class='me'> \" + data + \"</span>\");
}
});
});
$(\"#jd-chat\").delegate(\".close-this\",\"click\",function(){
removeItem = $(this).parents(\".jd-header\").attr(\"id\");
$(this).parents(\".jd-user\").remove();
open = $.grep(open, function(value) {
return value != removeItem;
});
});
$(\"#jd-chat\").delegate(\".jd-header\",\"click\",function(){
var box=$(this).parents(\".jd-user,.jd-online\");
$(box).find(\".jd-body,.jd-footer\").slideToggle();
});
$(\"#search_chat\").keyup(function(){
var val = $.trim($(this).val());
$(\".jd-online .jd-body\").find(\"span\").each(function(){
if ($(this).text().search(new RegExp(val, \"i\")) < 0 )
{
$(this).fadeOut();
}
else
{
$(this).show();
}
});
});
$(\"#jd-chat\").delegate(\".jd-user input\",\"keyup\",function(e){
if(e.keyCode == 13 )
{
var $cont = $('.jd-body');
var box=$(this).parents(\".jd-user\");
var msg=$(box).find(\"input\").val();
var to = $.trim($(box).find(\".jd-header\").attr(\"id\"));
$.ajax({
url:'chat.class.php',
type:'POST',
data:'send=true&to=' + to + '&msg=' + msg,
success:function(data){
$('#textareabox').val('');
$(box).find(\".jd-body\").append(\"<span style='display:block' class='me'> \" + msg + \"</span>\");
$cont[0].scrollTop = $cont[0].scrollHeight;
$cont.append('<span>' + $(this).val() + '</span>');
$cont[0].scrollTop = $cont[0].scrollHeight;
$(this).val('');
}
});
}
});
function message_cycle()
{
$.ajax({
url:'chat.class.php',
type:'POST',
data:'unread=true',
dataType:'JSON',
success:function(data){
$.each(data , function( index, obj ) {
var user = index;
var box = $(\"#jd-chat\").find(\"div#2\").parents(\".jd-user\");
$(\".jd-online\").find(\".light\").hide();
$.each(obj, function( key, value ) {
if($.inArray(user,open) !== -1 )
$(box).find(\".jd-body\").append(\"<span style='display:block' class='other'> \" + value + \"</span>\");
else
snd.play();
$(\".jd-online\").find(\"span#\" + user + \" .light\").show();
});
});
}
});
}
setInterval(message_cycle,1000);
});
// SNIPPET:
<body>
<div id=\"wrapper\">
<div class=\"loading\">more divs/p's/whatnots</div>
<div class=\"navigation\">more divs/p's/whatnots</div>
<div class=\"page\">more divs/p's/whatnots</div>
<div class=\"nav-buttons\">more divs/p's/whatnots</div>
<div class=\"certificate\">more divs/p's/whatnots</div>
</div>
</body>
// SNIPPET:
body {
height: 100px !important;
overflow: hidden !important;
}
body * {
visibility: hidden;
}
.certificate * {
visibility: visible;
}
// SNIPPET:
display:none;
// SNIPPET:
body *
// SNIPPET:
.certificate *
// SNIPPET:
display:none;
// SNIPPET:
body *
// SNIPPET:
body .page *
// SNIPPET:
body #wrapper *
// SNIPPET:
body #wrapper > *
// SNIPPET:
#wrapper
// SNIPPET:
body #wrapper .certificate
// SNIPPET:
display
// SNIPPET:
body #wrapper > *
{
visibility: hidden;
display: none;
}
body #wrapper .certificate {
visibility: visible;
display: table;
}
// SNIPPET:
input
// SNIPPET:
ng-click
// SNIPPET:
<ion-list>
<label class=\"item item-input\" input-clear >
<input type=\"text\"
ng-model=\"user.email\"
placeholder=\"{{ 'LOGIN.EMAIL_ID' | translate }}\">
</label>
</ion-list>
// SNIPPET:
.controller('forgotPasswordCtrl', function($scope) {
$scope.user = {};
});
// SNIPPET:
.directive('inputClear', function($compile) {
return {
restrict: 'A',
link : function (scope, element, attrs) {
// Find the input and bind keyup
var input = element.find(\"input\");
// Input length
scope.input = { len : 0 };
scope.clearInput = function () {
input[0].value = \"\";
console.log(input);
};
input.bind(\"keyup\", function() {
scope.input.len = input[0].value.length;
if(scope.input.len > 1) {
console.log(scope.input.len);
}
scope.$apply();
});
var el = angular.element('<a class=\"clear-text button-clear\" ng-show=\"input.len > 1\" ng-click=\"clearInput()\">X</a>');
$compile(el)(scope);
element.append(el);
}
};
})
// SNIPPET:
export default class DriftApp extends React.Component {
state = {//builder is not happy with this equals sign, unexpected token
showIndex: 0,
numSlides: 5
}
// SNIPPET:
\"homepage\": \"https://github.com/jaketrent/react-drift#readme\",
\"devDependencies\": {
\"autobind-decorator\": \"^1.3.3\",
\"babel-core\": \"^6.5.1\",
\"babel-loader\": \"^6.2.2\",
\"babel-plugin-react-transform\": \"^2.0.0\",
\"babel-plugin-transform-decorators-legacy\": \"^1.3.4\",
\"babel-preset-es2015\": \"^6.5.0\",
\"babel-preset-react\": \"^6.5.0\",
\"express\": \"^4.13.3\",
\"file-loader\": \"^0.8.4\",
\"radium\": \"^0.16.6\",
\"react\": \"^0.14.2\",
\"react-dom\": \"^0.14.2\",
\"react-hot-loader\": \"^2.0.0-alpha-4\",
\"react-tools\": \"^0.10.0\",
\"react-transform\": \"0.0.3\",
\"react-transform-catch-errors\": \"^1.0.0\",
\"react-transform-hmr\": \"^1.0.1\",
\"redbox-react\": \"^1.1.1\",
\"webpack\": \"^1.12.2\",
\"webpack-dev-middleware\": \"^1.2.0\",
\"webpack-hot-middleware\": \"^2.4.1\"
}
}
// SNIPPET:
.controller('mainCtrl', function ($scope, dataService) {
dataService.getUser(function (response) {
$scope.user = response.data[0];
})
// SNIPPET:
.service('dataService', function ($http) {
this.getUser = function (callback) {
$http.get('mock/user.json')
.then(callback)
};
// SNIPPET:
.controller('navCtrl', function ($scope, dataService) {
//$scope.user = \"test\";
console.log ($scope.user);
dataService.getNavItems($scope.user,function (response) {
$scope.navItems = response.data;
});
// SNIPPET:
<div class=\"col-xs-5\" data-bind=\"with: vm1\">
@Html.Partial(\"~/Views/Shared/Customers/Modals.cshtml\")
@Html.Partial(\"~/Areas/Shared/Views/Lookup.cshtml\")
</div>
<div class=\"col-xs-5\" data-bind=\"with: vm2\">
@Html.Partial(\"~/Views/Shared/Customers/Modals.cshtml\")
@Html.Partial(\"~/Areas/Shared/Views/Lookup.cshtml\")
</div>
// SNIPPET:
javascript:window.open(href='http://www.example.com/searchform.html?searchWord='+document.getElementById('example_entry'))
// SNIPPET:
Sign up now and start today!
// SNIPPET:
Inscrivez-vous et commencer
maintenant!
// SNIPPET:
Inscrivez-vous et
commencer maintenant!
// SNIPPET:
<script>
//ARRAY
var eventEquipmentArray = new Array();
eventEquipmentArray[\"15 Inch Speakers\"]=5;
eventEquipmentArray[\"18 Inch Subwoofer\"]=10;
eventEquipmentArray[\"LED Par Cans\"]=5;
eventEquipmentArray[\"Smoke Machine\"]=5;
eventEquipmentArray[\"Moving Head\"]=10;
eventEquipmentArray[\"4 Gun Laser System\"]=5;
eventEquipmentArray[\"Red Gun Laser System\"]=5;
eventEquipmentArray[\"1500W Strobes\"]=10;
eventEquipmentArray[\"Mirror LED Lighting\"]=5;
//CHECKBOX - EVENT EQUIPMENT
function getEventEquipment()
{
var EventEquipment = 0;
var theForm = document.forms[\"quote\"];
var selectedEquipment = theForm.elements[\"selectedEquipment\"];
for(var i = 0; i < selectedEquipment.length; i++)
{
EventEquipment = EventEquipment + eventEquipmentArray[selectedEquipment[i].value];
break;
}
return EventEquipment;
}
//DIV - TOTAL PRICE TEST
function getTotals()
{
var totalPrice = getEventDuration() + getEventSuburb() + getEventEquipment();
var totalPriceDIV = document.getElementById(\"totalPrice\");
totalPriceDIV.innerHTML = \"Total: $\"+totalPrice;
}
</script>
<form id=\"quote\" action=\"\" onsubmit=\"return false;\">
<p>
<label>
<input type=\"checkbox\" name=\"selectedEquipment\" value=\"15 Inch Speakers\" id=\"selectedEquipment_0\" onChange=\"getTotals()\" />
15\" Speakers</label>
<br />
<label>
<input type=\"checkbox\" name=\"selectedEquipment\" value=\"18 Inch Subwoofer\" id=\"selectedEquipment_1\" onChange=\"getTotals()\" />
18\" Subwoofer</label>
<br />
<label>
<input type=\"checkbox\" name=\"selectedEquipment\" value=\"LED Par Cans\" id=\"selectedEquipment_2\" onChange=\"getTotals()\" />
LED Par Cans</label>
<br />
<label>
<input type=\"checkbox\" name=\"selectedEquipment\" value=\"Smoke Machine\" id=\"selectedEquipment_3\" onChange=\"getTotals()\" />
Smoke Machine</label>
<br />
<label>
<input type=\"checkbox\" name=\"selectedEquipment\" value=\"250W Moving Head\" id=\"selectedEquipment_4\" onChange=\"getTotals()\" />
250W Moving Head</label>
<br />
<label>
<input type=\"checkbox\" name=\"selectedEquipment\" value=\"Mirror LED Lighting\" id=\"selectedEquipment_5\" onChange=\"getTotals()\" />
Mirror LED Lights</label>
<br />
<label>
<input type=\"checkbox\" name=\"selectedEquipment\" value=\"4 Gun Laser System\" id=\"selectedEquipment_6\" onChange=\"getTotals()\" />
4 Gun Laser Light</label>
<br />
<label>
<input type=\"checkbox\" name=\"selectedEquipment\" value=\"Red Gun Laser System\" id=\"selectedEquipment_7\" onChange=\"getTotals()\" />
Red Laser Star Light</label>
<br />
<label>
<input type=\"checkbox\" name=\"selectedEquipment\" value=\"1500W Strobes\" id=\"selectedEquipment_8\" onChange=\"getTotals()\" />
1500W Strobes</label>
<br />
</p>
<br />
<div id=\"totalPrice\" style=\"color: red; text-align: center; font-size: 18px;\"></div>
</form>
// SNIPPET:
[optgroup]-[option]
// SNIPPET:
Yes
// SNIPPET:
No
// SNIPPET:
$(window).bind('beforeunload', function(){
// check if any field is dirty
if ($('div.form').dirtyForms('isDirty')) {
var modalParams = {
Content: 'You have some unsaved changes, proceed?'
OnSave: navigateAndSave,
OnCancel: cancelNavigate
}
ShowModal(modalParams);
}
})
function navigateAndSave() {
// Do stuff
};
function cancelNavigate() {
// Stop page from unloading and close the modal
};
// SNIPPET:
cancelNavigate
// SNIPPET:
var format = [];
var formats = [];
var length = result.formats.length - 1;
for (var i = 0 ; i <= length; i++) {
var type = result.formats[i].type;
var type2 = type.split(/[;,]/);
var typee = type2[0];
var resolutions = result.formats[i].resolution;
var urls = result.formats[i].url;
format.push({
\"Type\": typee,
\"resolution\": resolutions
// \"url\": urls
})
};
var formatt = JSON.stringify(format, null, 4);
Session.set('format', JSON.stringify(format, null, 4));
console.log(formatt);
// SNIPPET:
[
{
\"Type\": \"video/webm\",
\"resolution\": \"360p\"
},
{
\"Type\": \"video/mp4\",
\"resolution\": \"360p\"
},
{
\"Type\": \"video/x-flv\",
\"resolution\": \"240p\"
},
{
\"Type\": \"video/3gpp\",
\"resolution\": \"240p\"
},
{
\"Type\": \"video/3gpp\",
\"resolution\": \"144p\"
},
{
\"Type\": \"video/mp4\",
\"resolution\": \"360p\"
},
{
\"Type\": \"video/webm\",
\"resolution\": \"360p\"
},
{
\"Type\": \"video/mp4\",
\"resolution\": \"240p\"
},
{
\"Type\": \"video/webm\",
\"resolution\": \"240p\"
},
{
\"Type\": \"video/mp4\",
\"resolution\": \"144p\"
},
{
\"Type\": \"video/webm\",
\"resolution\": \"144p\"
},
{
\"Type\": \"audio/webm\",
\"resolution\": null
},
{
\"Type\": \"audio/mp4\",
\"resolution\": null
},
{
\"Type\": \"audio/webm\",
\"resolution\": null
},
{
\"Type\": \"audio/webm\",
\"resolution\": null
},
{
\"Type\": \"audio/webm\",
\"resolution\": null
} ]
// SNIPPET:
\"Type\": \"video/webm\",
\"resolution\": \"360p\"
\"Type\": \"video/mp4\",
\"resolution\": \"360p\"
\"Type\": \"video/x-flv\",
\"resolution\": \"240p\"
\"Type\": \"video/3gpp\",
\"resolution\": \"240p\"
\"Type\": \"video/3gpp\",
\"resolution\": \"144p\"
\"Type\": \"video/mp4\",
\"resolution\": \"360p\"
\"Type\": \"video/webm\",
\"resolution\": \"360p\"
\"Type\": \"video/mp4\",
\"resolution\": \"240p\"
\"Type\": \"video/webm\",
\"resolution\": \"240p\"
\"Type\": \"video/mp4\",
\"resolution\": \"144p\"
\"Type\": \"video/webm\",
\"resolution\": \"144p\"
\"Type\": \"audio/webm\",
\"resolution\": null
\"Type\": \"audio/mp4\",
\"resolution\": null
\"Type\": \"audio/webm\",
\"resolution\": null
\"Type\": \"audio/webm\",
\"resolution\": null
\"Type\": \"audio/webm\",
\"resolution\": null
// SNIPPET:
{#each format}}
<tr>
{{> postItem}}
</tr>
{{/each}}
<template name=\"postItem\">
{{Type}}
{{resolution}}
{{url}}
</template>
Template.hello.helpers({
format:function(){
return Session.get('format');
}
});
// SNIPPET:
somemethod(function(item) {
return {id: item.id};
})
// SNIPPET:
somemethod((item) => {
return {id: item.id};
})
// SNIPPET:
somemethod(item = > {id: item.id} )
// SNIPPET:
somemethod(item = > {{id: item.id}} )
// SNIPPET:
somemethod(item = > new Object({id: item.id}) )
// SNIPPET:
$(this).bind(\"touchstart\", function(evt) {
// more hidden code
imageWrapper.removeClass(\"image-slider-animation\");
// more hidden code
}
// SNIPPET:
$(this).bind(\"touchend\", function(evt) {
imageWrapper.addClass(\"image-slider-animation\");
imageWrapper.css(\"transform\", \"translate(0px, 0px)\");
// more hidden code
}
// SNIPPET:
Function.prototype.method = function(name, func){
this.prototype[name] = func;
return this;
}
Number.method(\"add\", function(a, b){
console.log(a+b);
});
var a = new Number();
a.add(2,2);
// SNIPPET:
4
// SNIPPET:
Number.prototype.method = function(name, func){
this.prototype[name] = func;
return this;
}
Number.method(\"add\", function(a, b){
console.log(a+b);
});
var a = new Number();
a.add(2,2);
// SNIPPET:
Uncaught TypeError: Number.method is not a function
// SNIPPET:
function rgb(r, g, b) {
return \"rgb(\"+r+\",\"+g+\",\"+b+\")\";
}
document.getElementById(\"id1\").style.backgroundColor = rgb;
// SNIPPET:
<table>
<tbody>
<tr>
<td colspan=\"5\">
<textarea id=\"id1\" cols=\"50\" rows=\"10\"></textarea>
<!-- RGB value boxes !-->
</td>
<td>
R
<input type=text size=3 maxlength=3 name=\"r\" value=\"0\" onBlur=\"rgb(this.value);\">
</td>
<td>
G
<input type=text size=3 maxlength=3 name=\"g\" value=\"0\" onBlur=\"rgb(this.value);\">
</td>
<td>
B
<input type=text size=3 maxlength=3 name=\"b\" value=\"0\" onBlur=\"rgb(this.value);\">
</td>
// SNIPPET:
Warning: `div` was passed a style object that has previously been mutated. Mutating `style` is deprecated. Consider cloning it beforehand.
// SNIPPET:
<ComponentOne style={{left: this.state.left, top: this.state.top}} />
// SNIPPET:
data-remote=\"true\"
// SNIPPET:
var input = $(\"<input />\", { type:'hidden', name: fileInput.attr('name'), value: url })
// SNIPPET:
data-remote=\"true\"
// SNIPPET:
POST https://websmash.s3.amazonaws.com 201 Created x 1887ms
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<PostResponse><Location>https://websmash.s3.amazonaws.com/uploads%2F78f75...c59%2Feinstein.jpg</Location><Bucket>websmash</Bucket><Key>uploads/78f7...29c59/einstein.jpg</Key><ETag>\"c9ad...128f\"</ETag></PostResponse>
// SNIPPET:
<%= form_for(:message, url: :messages, method: :post, multiple: true,
html: { class: \"message_directUpload\",
data: { 'form-data' => (@s3_direct_post.fields), 'url' => @s3_direct_post.url,
'host' => URI.parse(@s3_direct_post.url).host } },
remote: true ) do |f| %>
<%= hidden_field_tag :callsign, @character.callsign %>
<%= hidden_field_tag :recipient, @recipient.callsign %>
<%= f.file_field :picture_url, accept: 'image/jpeg,image/gif,image/png', class: \"notice_file_field\",
id: \"message-file\" %>
<%= f.text_area :content, rows: 2, id: \"messagefield\", class: \"notice_area\" %>
<%= f.button( :submit, name: \"Send\", title: \"Send\", class: 'btn btn-default btn-xs notice_submit', id: 'messbutt',
onclick: \"return validateMessageForm();\" ) do %>
<span class=\"glyphicon glyphicon-ok\" aria-hidden=\"true\"></span>
<% end %>
<span class=\"noticeuploadbutton\" title=\"Add file\" >
<span class=\"glyphicon glyphicon-upload\" aria-hidden=\"true\"></span>
</span>
<% end %>
// SNIPPET:
<form class=\"message_directUpload\" data-form-data=\"{&quot;key&quot;=&gt;&quot;
uploads/6fb...139aa/${filename}&quot;,&quot;
success_action_status&quot;=&gt;&quot;201&quot;,&quot;acl&quot;=&gt;&quot;
public-read&quot;,&quot;policy&quot;=&gt;&quot;eyJl...1dfQ==&quot;, &quot;
x-amz-credential&quot;=&gt;&quot;AKI...0228/us-east-1/
s3/aws4_request&quot;, &quot;x-amz-algorithm&quot;=&gt;
&quot;AWS4-HMAC-SHA256&quot;, &quot;x-amz-date&quot;=&gt;
&quot;20160228T124211Z&quot;, &quot;x-amz-signature&quot;=&gt;&quot;
123aef...058e9&quot;}\"
data-url=\"https://websmash.s3.amazonaws.com\" data-host=\"websmash.s3.amazonaws.com\"
enctype=\"multipart/form-data\" action=\"/messages\" accept-charset=\"UTF-8\"
data-remote=\"true\" method=\"post\">
// SNIPPET:
Started POST \"/messages\" for ::1 at 2016-02-28 12:42:11 +0000
Processing by MessagesController#create as JS
Parameters: {\"utf8\"=>\"✓\",
\"authenticity_token\"=>\"/BEb8N/IWGJ...2FiQ==\",
\"callsign\"=>\"bazley\", \"recipient\"=>\"chump\",
\"message\"=>{\"content\"=>\"vvvv\"}, \"Send\"=>\"\"}
// SNIPPET:
Started POST \"/messages\" for ::1 at 2016-02-28 12:41:48 +0000
Processing by MessagesController#create as HTML
Parameters: {\"utf8\"=>\"✓\",
\"authenticity_token\"=>\"kvIB...K7Ew==\",
\"callsign\"=>\"bazley\", \"recipient\"=>\"chump\",
\"message\"=>
{\"picture_url\"=>\"//websmash.s3.amazonaws.com/uploads/
aeac08de-b97a-43c4-...d3d/einstein.jpg\",
\"content\"=>\"bbbb\"}, \"Send\"=>\"\"}
// SNIPPET:
<script type=\"text/javascript\">
$(function() {
$('.message_directUpload').find(\"input:file\").each(function(i, elem) {
var fileInput = $(elem);
var form = $(fileInput.parents('form:first'));
var submitButton = form.find('input[type=\"submit\"]');
submitButton.prop('disabled', true);
var progressBar = $(\"<div class='bar'></div>\");
var barContainer = $(\"<div class='progress'></div>\").append(progressBar);
fileInput.after(barContainer);
var maxFS = 10 * 1024 * 1024;
fileInput.fileupload({
fileInput: fileInput,
maxFileSize: maxFS,
url: form.data('url'),
type: 'POST',
autoUpload: true,
formData: form.data('form-data'),
paramName: 'file', // S3 does not like nested name fields i.e. name=\"user[avatar_url]\"
dataType: 'XML', // S3 returns XML if success_action_status is set to 201
replaceFileInput: false,
add: function (e, data) {
$.each(data.files, function (index, file) {
if (file.size > maxFS) {
alert('Alas, the file exceeds the maximum file size of 10MB.');
form[0].reset();
return false;
} else {
data.submit();
return true;
}
});
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
progressBar.css('width', progress + '%')
},
start: function (e) {
submitButton.prop('disabled', true);
progressBar.
css('background', 'green').
css('display', 'block').
css('width', '0%').
text(\"Preparing...\");
},
done: function(e, data) {
submitButton.prop('disabled', false);
progressBar.text(\"Ready\");
// extract key and generate URL from response
var key = $(data.jqXHR.responseXML).find(\"Key\").text();
var url = '//' + form.data('host') + '/' + key;
// create hidden field
var input = $(\"<input />\", { type:'hidden', name: fileInput.attr('name'), value: url })
form.append(input);
},
fail: function(e, data) {
submitButton.prop('disabled', false);
progressBar.
css(\"background\", \"red\").
text(\"Failed\");
}
});
});
});
</script>
// SNIPPET:
\"importScripts('http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/md5.js');\"+
// SNIPPET:
\"importScripts('path to local copy of md5.js');\"+
// SNIPPET:
InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable
// SNIPPET:
importScripts('path to local copy of md5.js');var md5, cryptoType;self.onmessage = function webWorkerOnMessage(e){
function arrayBufferToWordArray(ab) {
var i8a = new Uint8Array(ab);
var a = [];
for (var i = 0; i < i8a.length; i += 4) {
a.push(i8a[i] << 24 | i8a[i + 1] << 16 | i8a[i + 2] << 8 | i8a[i + 3]);
}
return CryptoJS.lib.WordArray.create(a, i8a.length);
}
if (e.data.type === \"create\") {
md5 = CryptoJS.algo.MD5.create();
postMessage({type: \"create\"});
} else if (e.data.type === \"update\") {
md5.update(arrayBufferToWordArray(e.data.chunk));
postMessage({type: \"update\"});
} else if (e.data.type === \"finish\") {
postMessage({type: \"finish\", hash: \"\"+md5.finalize()});
}
}
// SNIPPET:
Uncaught [object DOMException]
// SNIPPET:
<html ng-app=\"scotchApp\">
<head>
<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">
<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css\" integrity=\"sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r\" crossorigin=\"anonymous\">
<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js\"></script>
<script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js\"></script>
<script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js\"></script>
<script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/ngstorage/0.3.6/ngStorage.min.js\"></script>
<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>
<script src=\"./script.js\" type=\"text/javascript\"></script>
</head>
<body ng-controller=\"mainController\">
<header>
<nav class=\"navbar navbar-default\">
<div class=\"container\">
<div class=\"navbar-header\">
<a class=\"navbar-brand\" href=\"/\">Angular Routing Example</a>
</div>
<ul class=\"nav navbar-nav navbar-right\">
<li><a href=\"#\"><i class=\"fa fa-home\"></i> Home</a></li>
<li><a href=\"#about\"><i class=\"fa fa-shield\"></i> About</a></li>
<li><a href=\"#contact\"><i class=\"fa fa-comment\"></i> Contact</a></li>
</ul>
</div>
</nav>
</header>
<!-- MAIN CONTENT AND INJECTED VIEWS -->
<div id=\"main\">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment