Skip to content

Instantly share code, notes, and snippets.

Avatar
🧘

Yonghwan SO sio4

🧘
View GitHub Profile
@sio4
sio4 / resize_nocrop_noscale
Created Mar 27, 2016 — forked from maxivak/resize_nocrop_noscale
Crop and resize an image using MiniMagick in Ruby on Rails. Two approaches.
View resize_nocrop_noscale
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}")
@sio4
sio4 / authenticated_rest_adapter.js
Created Dec 10, 2015 — forked from marcoow/authenticated_rest_adapter.js
custom REST adapter for ember-data that sends the authentication token in a header
View authenticated_rest_adapter.js
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);
}
});
View gist:a18c2272b75d74907c88
###
# Namespace
###
Semantic = window.Semantic = Ember.Namespace.create
UI_DEBUG: false
UI_PERFORMANCE: false
UI_VERBOSE: false
###
# Mixin