Skip to content

Instantly share code, notes, and snippets.

View BinaryGeometry's full-sized avatar

Binary Geometry BinaryGeometry

View GitHub Profile
@BinaryGeometry
BinaryGeometry / background.js
Created March 1, 2018 09:56 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@BinaryGeometry
BinaryGeometry / gist:10823481
Created April 16, 2014 07:24
Passing Url Parameters from Magento Controller to Block view.If you
class Binarygeometry_Tallgallery_AjaxController extends Mage_Core_Controller_Front_Action
{
public function indexAction ()
{
//URL EXAMPLE tallgallery/ajax/index?prodid=187&&imagid=551
$productId = $this->getRequest()->getParam('prodid'); // get product id from url
$imageId = $this->getRequest()->getParam('imagid'); // get image id from url
$imageSize = $this->getRequest()->getParam('resize');
Mage::helper('catalog/product')->initProduct($productId, $this); // make available to layout
@BinaryGeometry
BinaryGeometry / gist:9214529
Created February 25, 2014 18:13
Firing Function on Ember Change Event
<input type="checkbox" {{action "foo" on="change"}}>
App.MenusController = Ember.ObjectController.extend({
// initial value
isExpanded: false,
actions: {
foo: function() {
alert('works');
}
@BinaryGeometry
BinaryGeometry / Configure codeigniter-restserver for use with Ember.js
Last active August 10, 2016 09:26
Configure codeigniter-restserver for use with Ember.js
First off you need to modify application/config/rest.php
```
$config['rest_default_format'] = 'json';
```
This will ensure that when your api call is made the server will return json without an additional segment.
You must then create an api controller that will return your codeigniter model in the correct format for Ember.js
```
<?php
require(APPPATH.'/libraries/REST_Controller.php');