instafeedjs doesn't work on my site - instafeedjs

I'm trying to set up instafeedjs but it doesn't work.
script type="text/javascript" src="/instafeed.min.js"></script>
<script>
var feed = new Instafeed({
clientId: '377e47596dcf4fc284d36fe0098700ba',
useHttp: true
});
feed.run();
</script>

Please make sue the, you have done the following steps in your code.
Added a div tag with id "instafeed"
Mapped the instafeed.js library correctly.
Refer the code blog below for more info.
var feed = new Instafeed({
clientId: '377e47596dcf4fc284d36fe0098700ba',
useHttp: true
});
feed.run();
<script src="http://sriajith.info/wp-content/uploads/2015/05/instafeed.min_.js"></script>
<div id="instafeed"/>

Related

Unable to Execute Jquery from sidebar in Addon Firefox SDK

I am new to this Firefox SDK , but what i have understood you can execute content Scripts on Pages.
Here is the Code
MAIN.JS
var tabs = require("sdk/tabs");
var data = require("sdk/self").data;
var sidebar = require("sdk/ui/sidebar").Sidebar({
id: 'my-sidebar',
title: 'My sidebar',
url: data.url("index.html"),
onReady: function (worker) {
worker.port.emit('turl',tabs.activeTab.url);
}
});
SIDEBAR.JS
$('#bt1').on('click',function(){
$('title').textContent;
});
INDEX.HTML
<!DOCTYPE HTML>
<html>
<body>
<input type="button" id="bt1" value="Click Me"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="sidebar.js"></script>
</body>
</html>
But this code tries to find out title of the Sidebar html.
I have also tried using contentScriptFile in Main.js but same thing happened
var tabs = require("sdk/tabs");
var data = require("sdk/self").data;
var sidebar = require("sdk/ui/sidebar").Sidebar({
id: 'my-sidebar',
title: 'My sidebar',
url: data.url("index.html"),
contentScriptFile: [data.url("jquery.min.js"),data.url("sidebar.js")],
onReady: function (worker) {
worker.port.emit('turl',tabs.activeTab.url);
}
});
The Jquery code is in the sidebar.js
Still no Results.Please help
There is no contentScriptFile for the Sidebar class.
Try this: copy the jquery library to a local file in the data folder, then refer to it using a relative path. Sidebars can only use 'local' JS, they cannot load scripts from the internet.

Compile CoffeeScript in the browser with extras/coffee-script.js

I would like to create a simple demo page that compiles CoffeeScript in the browser with the extras/coffee-script.js. However, when I add this source and write my CoffeeScript within my text/coffeescript tags it is compiled in a closure so I don't have access to the CoffeeScript functions in the browser console.
In order to do so, I would need to do
<script type="text/coffeescript">
window.learning = ->
"I am learning coffeescript"
</script>
<script type="text/javascript" src="js/vendors/coffee-script.js"></script>
This is not ideal for my presentation. I would like to add the bare = true option so that I have access to the functions in browser console. Where in the extras/coffee-script.js do I add this option?
Here is the compiled js:
(function() {
window.learning = function() {
return "I am learning coffeescript";
};
})
I have this example.coffee:
learning = ->
"I am learning coffeescript"
Running the compiler from the command line with the following:
coffee -c --bare example.coffee
It is compiled to this example.js:
// Generated by CoffeeScript 1.6.2
var learning;
learning = function() {
return "I am learning coffeescript";
};
This will be globally available from the console.
The below code prints out to the console: I am learning coffeescript
Note: window.learning is available in the console on the global scope.
<html>
<body>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/coffee-script/1.1.2/coffee-script.min.js"></script>
<script type="text/coffeescript">
window.learning = ->
"I am learning coffeescript"
</script>
<script type="text/javascript">
setTimeout(function(){ console.log(window.learning()); }, 1000);
</script>
</body>
</html>
Where ever you call the CoffeeScript.compile function, you can pass in the --bare option, much like the command line:
CoffeeScript.compile(source, { bare: true });
If you look in the minified source, at the end you will see this:
CoffeeScript.run(a.innerHTML,s)
Where a is the <script> element, (so a.innerHTML is the source) and s is the options, which is then passed through run into compile:
CoffeeScript.run = function (e,t){return null==t&&(t={}),t.bare=!0,Function(compile(e,t))()}
As you can see, t.bare is set to !0 (aka true), so bare is already set!

ExtJS disableCache doesn´t working

I use ExtJS 4 and a RESTProxy. Every time I send a request (PUT or GET) I get the cache included in my request:
http://localhost:9000/todos?_dc=1355520254945
Here is my Store definition:
Ext.define('MyStore'), {
extend: 'Ext.data.Store',
model: 'MyModel',
proxy: {
type: 'rest',
url: '/todos',
disableCaching: false
}
});
I used also disableCaching: false, but it doesn´t work.
try this:
noCache: false
because disableCaching field doesn´t exists.
You can turn off caching globally like this
<script src="ext-all.js" type="text/javascript"></script>
<script type="text/javascript">
Ext.data.Connection.disableCaching = false; // for file uploads
Ext.data.proxy.Server.prototype.noCache = false; // for all stores loads
Ext.Ajax.disableCaching = false; // for all Ext.Ajax.request()
</script>
<script type="text/javascript" src="app.js"></script>

FBJS streemPublish not working

In my application I want post a text message in facebook wall streemPublish but it is not working, can anyone tell me what i did wrong else guide me a good working tutorial,
also the below code does not showing any error....
Here is my code ...
<body>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script type="text/javascript">
function publish() {
FB_RequireFeatures(["Connect"], function() {
FB.Facebook.init('113700398662301', 'xd_receiver.htm');
FB.ensureInit(function() {
var message = 'this is message';
var action_links = [{ 'text': 'Vote for Bill The Aircraft Carrier!', 'href': 'http://spayday.factor360.com/contest.html?page=viewInd&id=48082&contestId=2'}];
FB.Connect.streamPublish(message, action_links, null, "Share your support for Bill The Aircraft Carrier!", callback, false, null);
});
function callback(post_id, exception) {
alert('Wall Post Complete');
}
});
}
</script>
</body>
<p>Stream Publish Test</p>
Post a story
</html>
The code looks a little dated. Check this for updated info on stream publishing
https://developers.facebook.com/docs/reference/javascript/FB.ui/
and this for setting up your FB init.
https://developers.facebook.com/blog/post/525/

backbone.js - problem loading using models defined in separate file

I'm running Sinatra with Backbone.js. I'm trying to split up my models, views, etc so they aren't all lumped into a single JS file. Right now I have the following.
index.html
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<script src="scripts/underscore-min.js"></script>
<script src="scripts/jquery-1.5.min.js"></script>
<script src="scripts/backbone-min.js"></script>
<script src="scripts/models.js"></script>
...
models.js
Models = {
var Event = Backbone.Model.extend({
});
var Events = Backbone.Collection.extend({
url: '/events',
model: Event
});
};
So models.js expects that Backbone.js has been loaded, which it should have been based on index.html, however, I'm getting a JavaScript error in models.js where I reference Backbone.Model.
Any ideas on what I'm missing here?
That isn't valid javascript. Something like this is more likely to work :
Models = {}
Models.Event = Backbone.Model.extend({
});
Models.Events = Backbone.Collection.extend({
url: '/events',
model: Event
});