Skip to content

Instantly share code, notes, and snippets.

View andrewkowalik's full-sized avatar
👋

Andrew Kowalik andrewkowalik

👋
View GitHub Profile
@goliatone
goliatone / dumpdbs3.py
Last active May 9, 2019 08:28
Simple django management command to dump database using mysqldump, pg_dump, or sqlite3 .dump, and store in S3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
# from django.core.management.base import CommandError
from optparse import make_option
from django.conf import settings
import os
import sys
import yaml
from boto.s3.connection import S3Connection
@brobertsaz
brobertsaz / serversetup.md
Last active July 6, 2020 08:56
Ubuntu 12.04 Ruby, Rails, Nginx, Unicorn

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key
@labnol
labnol / mail-merge-gmail.js
Last active August 14, 2019 00:50 — forked from gnunicorn/mass_emailer.js
Source Code for Mail Merge
/*
* Added Remaining Quota Notifications
* Renamed a few menu options
* Forked from gist: 1838132 by ligthyear
*/
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "Start Mail Merge", functionName: "fnMailMerge"}];
ss.addMenu("Mail Merge", menuEntries);
@daveaugustine
daveaugustine / Inside_your_router.coffee
Created February 8, 2012 18:33
Super simple Google Analytics page tracking with backbone
initialize: ->
@bind 'all', @_trackPageview
_trackPageview: ->
url = Backbone.history.getFragment()
_gaq.push(['_trackPageview', "/#{url}"])
@brianly
brianly / Solarized Dark.xml
Created January 16, 2012 18:47
Solarized Dark for PyCharm (Brian's edits of https://github.com/jkaving/intellij-colors-solarized)
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="Solarized Dark" version="1" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="14" />
<option name="EDITOR_FONT_NAME" value="Consolas" />
<colors>
<option name="ADDED_LINES_COLOR" value="" />
<option name="ANNOTATIONS_COLOR" value="2b36" />
<option name="ANNOTATIONS_MERGED_COLOR" value="" />
<option name="CARET_COLOR" value="dc322f" />
@WizardOfOgz
WizardOfOgz / gist:1012107
Created June 7, 2011 12:13
Save Base64-encoded images with Paperclip
class Avatar < ActiveRecord::Base
attr_accessor :content_type, :original_filename, :image_data
before_save :decode_base64_image
has_attached_file :image,
PAPERCLIP_CONFIG.merge(
:styles => {
:thumb => '32x32#',
:medium => '64x64#',
@knzconnor
knzconnor / 1_intro_to_subject.rb
Created February 8, 2011 07:45
A pattern for testing class methods in ruby with rspec explicit subjects
# RSpec's subject method, both implicitly and explicitly set, is useful for
# declaratively setting up the context of the object under test. If you provide a
# class for your describe block, subject will implicitly be set to a new instance
# of this class (with no arguments passed to the constructor). If you want
# something more complex done, such as setting arguments, you can use the
# explicit subject setter, which takes a block.
describe Person do
context "born 19 years ago" do
subject { Person.new(:birthdate => 19.years.ago }
it { should be_eligible_to_vote }