Skip to content

Instantly share code, notes, and snippets.

View scottweisman's full-sized avatar

Scott Weisman scottweisman

View GitHub Profile
@scottweisman
scottweisman / HTML Email in Rails
Last active August 29, 2015 13:58
HTML Email in Rails
Less painful html emails in Rails:
1. Install roadie and and mail_view gems
2. Setup MailPreview class in mailers directory & setup your variables (follow mail_view directions)
3. Download a mail template that's close to the design you want from Ink by Zurb http://zurb.com/ink/templates.php
4. Put the external stylesheet from the Ink template called 'email.css' in your stylesheets directory
5. Make sure the external stylesheet link tag goes to email.css <link rel="stylesheet" type="text/css" href="email.css" />
6. Tweak the email.css stylesheet as needed, or add your own custom styles
7. Preview the email at http://localhost:3000/mail_view
@scottweisman
scottweisman / payments.rb
Last active August 29, 2015 14:04
Export Payments CSV
def payment_details_keys
payment_details = Payment.select(:details).map(&:details)
keys = payment_details.map {|d| d.keys}.flatten.compact
end
app.controller("CommentsCtrl", ['$scope', 'Post', 'Comment', function($scope, Post, Comment){
$scope.init = function(company_id, id, comment_type){
$scope.company_id = company_id
$scope.post_id = id
$scope.post = Post.get({ company_id: company_id, id: id });
$scope.comment_type = comment_type
console.log(comment_type)
};
@scottweisman
scottweisman / routes.js
Created August 26, 2014 14:35
Ember vs Angular Routes
// ember
Router.map(function() {
this.resource('phones', function() {
this.route('show', {path: ':phone_id'});
});
});
// Angular
phonecatApp.config(['$routeProvider',
@scottweisman
scottweisman / korean-monitors.md
Created August 27, 2014 19:46
Korean Monitors

Here's the monitor I ended up getting: http://www.ebay.com/itm/130933197737?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

The best sellers seem to be accessorieswhole, green-sum, and dream-seller.

It seems like ebay is the way to go with these. These guys sell tons of them through ebay, the feedback is typically good, and they offer good return policies (not sure how good they would be in practice). I didn't get one that was "pixel perfect" because I couldn't find the model I wanted advertised like that. I haven't found any dead pixels yet, so I guess I got lucky, or the risk is overblown.

The most important thing is to get one with displayport (dport or DP). Otherwise, you have to get a shitty $100 adapter from apple. Other than that, choose matte or glossy and find the best deal you can get. The Qnix was the only reasonably priced one I found that was matte and offered a version with a displayport. Read the descriptions carefully because there are sometimes a few models of each brand.

You can goo

@scottweisman
scottweisman / factories.js
Created September 5, 2014 02:41
Angular factories
app.factory("Member", ['$resource', function($resource){
return $resource('/companies/:company_id/members/:id.json', { company_id: '@company_id', id: '@id' }, {
"send_invite": {
method: 'post'
}
});
}]);
app.factory("Group", ['$resource', function($resource){
return $resource('/companies/:company_id/groups/:id.json', { company_id: '@company_id', id: '@id' });
@scottweisman
scottweisman / predawn.tmTheme
Created September 15, 2014 01:10
Sublime 3 Predawn Theme change background color for Rails erb
<dict>
<key>name</key>
<string>Embedded Source (Bright)</string>
<key>scope</key>
<string>text.html.ruby source</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#282828</string>
</dict>
@scottweisman
scottweisman / resque-notes
Last active August 29, 2015 14:06
Resque Notes
# start redis server
$ redis-server
# start resque workers
$ bundle exec rake resque:workers QUEUE='clips' COUNT='8'
$ bundle exec rake resque:workers QUEUE='uploads' COUNT='2'
@scottweisman
scottweisman / application.rb
Created September 27, 2014 05:30
RSpec - Turn off generators
config.generators do |g|
g.test_framework :rspec,
fixtures: true,
view_specs: false,
helper_specs: false,
controller_specs: false,
routing_specs: false
g.factory_girl true
end
@scottweisman
scottweisman / .gitconfig
Created September 29, 2014 20:37
gitconfig aliases
[alias]
co = checkout
br = branch
ci = commit
st = status
pom = pull origin master