Skip to content

Instantly share code, notes, and snippets.

View scottweisman's full-sized avatar

Scott Weisman scottweisman

View GitHub Profile
@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 / 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 / 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 / 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 / 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',
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 / 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
@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 / .bash_profile
Created November 11, 2013 19:46
Bash Profile
export PATH=/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
eval "$(rbenv init -)"
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
@scottweisman
scottweisman / bootstrap_nav_active.js
Created November 11, 2013 05:47
Highlight current page in navigation by adding an active class to li. Example is with bootstrap 2, but could be adapted to anything. Make sure to add #home to your home page's li element.
$(document).ready(function() {
var pathname = window.location.pathname;
$(".nav li").each(function(index) {
if (pathname.toUpperCase().indexOf($(this).text().toUpperCase()) != -1)
$(this).addClass("active");
});
if ($(".nav li.active").length == 0)
$("li#home").addClass("active");