Skip to content

Instantly share code, notes, and snippets.

View scottweisman's full-sized avatar

Scott Weisman scottweisman

View GitHub Profile
<% if current_user %>
heap.identify({email: "<%= current_user.email %>", name: "<%= current_user.full_name %>"});
<% end %>
@scottweisman
scottweisman / tour.js
Created December 10, 2014 16:37
hopscotch tour status
var getTourStatus = function() {
var tourStatus = "";
$.ajax({
type: "GET",
url: "/users/" + userId + ".json",
dataType: "json",
data: { get_param: 'finished_tour' },
success: function(data) {
var tourStatus = data.finished_tour;
if(!tourStatus) {
@scottweisman
scottweisman / hopscotch-helpers.js
Last active August 29, 2015 14:10
Hopscotch JS Helpers
onShow: function() {
$('.record a').click(function(){
var link = $(this).attr('href');
alert(link);
});
}
@scottweisman
scottweisman / postgres-upgrade.md
Last active August 29, 2015 14:08
Upgrade Postgress.app

Update Postgres or Mac OS without losing local databases

  1. Dump all databases: $ pg_dumpall > db.out

  2. Delete current postgres.app

  3. Download & install new posgres.app

  4. Reload database: $ psql -f db.out postgres

{
"caret_extra_width": 1,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/User/predawn (SL).tmTheme",
"copy_with_empty_selection": false,
"drag_text": false,
"enable_tab_scrolling": false,
"file_exclude_patterns":
[
@scottweisman
scottweisman / heroku.rake
Created October 21, 2014 15:49
heroku tasks
namespace :heroku do
desc 'Pull most recent DB from Heroku and dump into local'
task :db_pull => :environment do
heroku_app = "my-app-name"
local_db = "local-db_dev"
system "heroku pgbackups:capture --expire --app #{heroku_app}"
system "curl -o latest.dump `heroku pgbackups:url --app #{heroku_app}`"
system "pg_restore --verbose --clean --no-acl --no-owner -h localhost -d #{local_db} latest.dump"
end
@scottweisman
scottweisman / factories.js
Created September 30, 2014 14:51
Angular vs Ember Factories
// Angular
app.factory("User", ['$resource', function($resource){
return $resource('/companies/:company_id/members/:id', { company_id: '@company_id', id: '@id' });
}]);
app.factory("Group", ['$resource', function($resource){
return $resource('/companies/:company_id/groups/:id.json', { company_id: '@company_id', id: '@id' });
}]);
@scottweisman
scottweisman / .gitconfig
Created September 29, 2014 20:37
gitconfig aliases
[alias]
co = checkout
br = branch
ci = commit
st = status
pom = pull origin master
@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