Skip to content

Instantly share code, notes, and snippets.

View alekpopovic's full-sized avatar
🏠
Working from home

Aleksandar Popovic alekpopovic

🏠
Working from home
View GitHub Profile
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');
@alekpopovic
alekpopovic / digital_ocean_setup.md
Created March 30, 2016 19:32 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions
@alekpopovic
alekpopovic / routes.rb
Created April 4, 2016 20:53 — forked from ThomasHambach/routes.rb
Rails redirect to default locale
Rails.application.routes.draw do
scope "/:locale" do
# blablabla..
end
root to: "welcome#index"
get '/:locale' => 'welcome#index', :as => 'locale_root'
end
@alekpopovic
alekpopovic / backbone.api.facebook.js
Created April 11, 2016 19:08 — forked from tracend/backbone.api.facebook.js
[DEPRECATED] Backbone.js APIs: Facebook Project moved: http://github.com/backbone-api/facebook
/* Backbone API: Facebook
* Source: https://github.com/backbone-api/facebook
*
* Created by Makis Tracend (@tracend)
* Distributed through [Makesites.org](http://makesites.org)
* Released under the [MIT license](http://makesites.org/licenses/MIT)
*/
// Assuming that Facebook JS lib is loaded...
if( window.FB ) (function(_, Backbone) {
@alekpopovic
alekpopovic / add.js
Created April 13, 2016 09:52 — forked from simenbrekken/add.js
Backbone.js form submission
define([
'backbone',
'underscore',
'project/views/form'
], function(Backbone, _, ProjectFormView) {
var View = Backbone.View.extend({
events: {
'submit form': 'submit'
},
@alekpopovic
alekpopovic / install_elixir.md
Created April 19, 2016 21:31 — forked from rubencaro/install_elixir.md
Elixir installation guide

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir and you are good to go.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then kerl and exenv are your best friends.

@alekpopovic
alekpopovic / gist:ee2235bfc74722a82714353e9c7bc58e
Created May 9, 2016 11:29 — forked from nathancolgate/gist:1072361
Copying a file from HTTP to S3 via a local temp file in Ruby
# This copies a file from HTTP to S3
require 'net/http'
require 'aws/s3'
http_url = 'http://www.google.com/intl/en_com/images/srpr/logo1w.png'
http_domain = http_url.gsub('http://','').split('/')[0]
http_path = '/' + http_url.gsub('http://','').split('/')[1..999].join('/')
file_name = File.basename(http_url)
s3_path = "path/to/new/#{file_name}"
nginx:
image: fntlnz/nginx
volumes:
- docker/nginx/conf:/usr/local/nginx/conf
- docker/nginx/logs:/usr/local/nginx/logs
volumes_from:
- fpm
links:
- fpm:fpm
var user = "hantu";
$(document).ready(function() {
$.getJSON("http://github.com/api/v1/json/" + user + "?callback=?", function(data) {
$.each(data.user.repositories, function() {
$("body").append(
"<p><a href=\"" + this.url + "\">" + this.name + "</a></p>"
);
});
});
});
@alekpopovic
alekpopovic / gif_processes.rb
Created June 6, 2016 14:36 — forked from sunny/gif_processes.rb
Addon to CarrierWave to process GIF files.
# lib/addons/carrierwave/gif_processes.rb
#
# Addons to CarrierWave to process GIF files with RMagick.
#
# Example:
#
# class AvatarUploader < CarrierWave::Uploader::Base
# include CarrierWave::GifProcesses
#
# version :medium do