This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$words = Array("cat", "dog", "fish", "rabbit"); | |
foreach($words as $word) { | |
file_put_contents("$word.mp3", fopen("https://ssl.gstatic.com/dictionary/static/sounds/de/0/$word.mp3", 'r')); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.URL = window.URL || window.webkitURL | |
var blob = new Blob(['body { color: red; }'], {type: 'text/css'}) | |
var link = document.createElement('a') | |
link.innerHTML = 'Click to download style.css.' | |
link.href = window.URL.createObjectURL(blob) | |
// Name the Blob so it doesn't result in a gibberish name | |
link.download = 'style.css' | |
// Append the download link to the body | |
document.body.appendChild(link) | |
// Optionally, if you want this to immediately download and don't care about the download link, run the click method |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SomeModelClass = Backbone.Model.extend({ | |
idAttribute: "_id", | |
url: function() { | |
if (_.has(this, 'id')) { | |
var url = (_.has(this.toJSON(), '_rev')) | |
? this.server + '/' + this.db + '/' + this.id + '?rev=' + this.get('_rev') // For UPDATE and DELETE | |
: this.server + '/' + this.db + '/' + this.id // For READ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test.ReplicateToDbThenOpenDb() | |
07-10 01:16:15.217: I/Web Console(6543): DEVICE READY 14 at file:///android_asset/www/index.html:23 | |
07-10 01:16:15.317: D/SurfaceTextureClient(6543): dispatchSetBuffersGeometry1! | |
07-10 01:16:15.317: D/SurfaceTextureClient(6543): dispatchSetBuffersGeometry2! | |
07-10 01:16:16.197: I/SqliteDatabaseCpp(6543): sqlite returned: error code = 1, msg = no such table: CacheGroups, db=/data/data/com.Test.TestPouch/databases/webview.db | |
07-10 01:16:16.197: I/SqliteDatabaseCpp(6543): sqlite returned: error code = 1, msg = no such table: Caches, db=/data/data/com.Test.TestPouch/databases/webview.db | |
07-10 01:16:16.197: I/SqliteDatabaseCpp(6543): sqlite returned: error code = 1, msg = no such table: Origins, db=/data/data/com.Test.TestPouch/databases/webview.db | |
07-10 01:16:16.197: I/SqliteDatabaseCpp(6543): sqlite returned: error code = 1, msg = no such table: DeletedCacheResources, db=/data/data/com.Test.TestPouch/databases/webview.db | |
07-10 01:16:16.507: D/CordovaLog(6543): DroidGap: onExceed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<!-- Android | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" /> | |
<meta charset="utf-8">--> | |
<!-- iPad/iPhone specific css below, add after your main css > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(params.db && params.docId && params.file) { | |
Pouch(params.db, function(err, db) { | |
db.getAttachment(params.docId, params.file, function(err, res) { | |
var file = window.URL.createObjectURL(res) | |
//#if (FIREFOX || MOZCENTRAL) | |
//if (FirefoxCom.requestSync('getLoadingType') == 'passive') { | |
// PDFView.setTitleUsingUrl(file); | |
// PDFView.initPassiveLoading(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PDFJS.getDocument(url).then(function(pdf) { | |
// Using promise to fetch the page | |
pdf.getPage(1).then(function(page) { | |
// Scale the PDF to the width of the window | |
var scale = window.innerWidth / page.view[2] | |
var viewport = page.getViewport(scale); | |
// | |
// Prepare canvas using PDF page dimensions | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x = { | |
value: 1, | |
change: function() { | |
var that = this | |
that.value++ | |
var foo = 1 | |
var bar = foo | |
bar++ | |
alert(foo) // alerts 1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$codeToCountry = array( | |
"af" =>"Afghanistan", | |
"ax" =>"Aland Islands", | |
"al" =>"Albania", | |
"dz" =>"Algeria", | |
"as" =>"American Samoa", | |
"ad" =>"Andorra", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onscroll = function() { | |
var speed = 3.0; | |
$("#some-container").css("background-position",(window.pageXOffset / speed) + "px " + (window.pageYOffset / speed) + "px"); | |
// Scroll the background faster instead of slower | |
// $("#some-container").css("background-position",(-window.pageXOffset / speed) + "px " + (-window.pageYOffset / speed) + "px"); | |
} |