Skip to content

Instantly share code, notes, and snippets.

View sio4's full-sized avatar
😱
Panic again

Yonghwan SO sio4

😱
Panic again
View GitHub Profile
###
# Namespace
###
Semantic = window.Semantic = Ember.Namespace.create
UI_DEBUG: false
UI_PERFORMANCE: false
UI_VERBOSE: false
###
# Mixin
@sio4
sio4 / authenticated_rest_adapter.js
Created December 10, 2015 03:00 — forked from marcoow/authenticated_rest_adapter.js
custom REST adapter for ember-data that sends the authentication token in a header
App.AuthenticatedRESTAdapter = DS.RESTAdapter.extend({
ajax: function(url, type, hash) {
hash = hash || {};
hash.headers = hash.headers || {};
hash.headers['X-AUTHENTICATION-TOKEN'] = this.authToken;
return this._super(url, type, hash);
}
});
@sio4
sio4 / resize_nocrop_noscale
Created March 27, 2016 16:11 — forked from maxivak/resize_nocrop_noscale
Crop and resize an image using MiniMagick in Ruby on Rails. Two approaches.
def resize_nocrop_noscale(image, w,h)
w_original = image[:width].to_f
h_original = image[:height].to_f
if w_original < w && h_original < h
return image
end
# resize
image.resize("#{w}x#{h}")