Skip to content

Instantly share code, notes, and snippets.

class ParentDoc
include Mongoid::Document
embeds_many :child_docs
field :statistic
field :children_order, :type => Array, :default => [] # hold all the children's id
end
module Devise
module Orm
module MongoMapper
module Hook
def devise_modules_hook!
extend Schema
include Compatibility
yield
return unless Devise.apply_schema
devise_modules.each { |m| send(m) if respond_to?(m, true) }
user app;
worker_processes 2;
error_log /home/app/logs/nginx.error.log info;
events {
worker_connections 1024;
}
#!/bin/bash
#
# This script backups an OS X system to an external volume, effectively
# cloning it. It is based on [0], [1] and [2] for OS X and [3] and [4] for
# Linux. One could also use commercial tools like SuperDuper! or Carbon Copy
# Cloner. The latter website has an interesting list[5] on what files to
# exclude when cloning.
#
# Exclusions (from CCC[5]), see rsync_excludes_osx.txt
#
# The Nginx configuration based on https://coderwall.com/p/rlguog
http {
ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_session_timeout 15m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
from functools import wraps
def juggle(f):
"""
Suppose we have a binary function
>>> def add(a, b):
... return a + b
You could call `it` in following way
@Aaron2Ti
Aaron2Ti / install_sentry.sh
Created April 27, 2017 10:00 — forked from bjmc/install_sentry.sh
Basic setup script for installing Sentry (http://getsentry.com) + Redis on new Ubuntu 14.04 Amazon EC2 instance
#! /bin/bash
export RUN_AS='ubuntu';
export INSTALL_DIR='/var/www/sentry';
HOSTNAME='http://mysentry.example.com'; # No trailing slash
DB_HOST='something.rds.amazonaws.com';
DB_PORT='5432';
DB_USER='sentry';
DB_NAME='sentry';
DB_PASSWORD='DB_PASSWORD';
@Aaron2Ti
Aaron2Ti / aws_sns_push_notification.rb
Created October 26, 2018 23:52 — forked from jkotchoff/aws_sns_push_notification.rb
Sends a push notifications to an iOS and an Android device from Amazon SNS V2
require 'rubygems'
require 'aws-sdk'
# This code snippet sends a push notification to a device using the Amazon SNS service.
#
# It is using the preview V2 amazon gem as per:
# https://aws.amazon.com/sdk-for-ruby/
#
# This was installed using:
# $ gem install aws-sdk --pre
@Aaron2Ti
Aaron2Ti / deploy-static-site-heroku.md
Created November 18, 2018 09:59 — forked from wh1tney/deploy-static-site-heroku.md
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@Aaron2Ti
Aaron2Ti / README.md
Created December 3, 2018 22:14 — forked from mbbx6spp/README.md
Doing DNS SRV lookups in Ruby using stdlib in 2.3.0

DNS SRV Lookups in Ruby

Prerequisites

  • Nix 1.11+ OR Ruby 2.3.x

If using Nix you can just load the environment with nix-shell shell.nix.

Now we can test an entry via command-line using host or dig commands: