Skip to content

Instantly share code, notes, and snippets.


Constant Meiring constantm

View GitHub Profile
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
constantm / gist:0aa3d8398e72e4f5e7fe
Created Aug 21, 2015
Check whether paperclip attachment is exists in callback
View gist:0aa3d8398e72e4f5e7fe
In our app, we need to work out user profile completeness when a profile is saved. This is done via a callback. In this callback, we also check for the existance of Paperclip attachments.
This should supposedly be done with the following:
That, however, returns false in the callback while a file is being uploaded. It looks like it's stuck in limbo between deleting the old file and saving the new one. A solution to this is to simply use the following:
constantm / Ruby countries hash
Last active Oct 27, 2016 — forked from vxnick/gist:380904
Ruby countries hash
View Ruby countries hash
countries = {
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
'AQ' => 'Antarctica',