I hereby claim:
- I am alex-nexus on github.
- I am alexchen (https://keybase.io/alexchen) on keybase.
- I have a public key whose fingerprint is A94E D302 70D7 4D9C 3362 F913 5F35 93BC 57D9 A5A7
To claim this, I am signing this object:
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(query_start, clock_timestamp()), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
I hereby claim:
To claim this, I am signing this object:
| from decimal import Decimal | |
| from random import random | |
| from time import time | |
| fs = [] | |
| ds = [] | |
| for i in range(1000000): | |
| rn = random() | |
| fs.append(float(rn)) | |
| ds.append(Decimal(rn)) |
| # It’s worth noting that the UI now will not be served by rails, it might even sit in a different server. There are solution that let us keep both UI and API on the same domain, but for now we will need to enable Cross-origin resource sharing (CORS). | |
| # We can do this by adding the rack-cors gem to our Gemfile and then add this in our config/application.rb: | |
| config.middleware.insert_before 'Rack::Runtime', 'Rack::Cors' do | |
| allow do | |
| origins '*' | |
| resource '*', | |
| headers: :any, | |
| methods: [:get, :put, :post, :patch, :delete, :options] | |
| end |
| ○ → ionic start myApp tabs | |
| Creating Ionic app in folder /Volumes/Work/hybrid/myApp based on tabs project | |
| Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip | |
| [=============================] 100% 0.0s | |
| Downloading: https://github.com/driftyco/ionic-starter-tabs/archive/master.zip | |
| [=============================] 100% 0.0s | |
| Updated the hooks directory to have execute permissions | |
| Update Config.xml | |
| Initializing cordova project | |
| Adding in iOS application by default |
| FROM ruby:2.2.2 | |
| ################################# | |
| # native libs | |
| ################################# | |
| RUN apt-get update -qq && apt-get install -y build-essential | |
| # for postgres | |
| RUN apt-get install -y libpq-dev |
| from datetime import datetime | |
| import time | |
| #------------------------------------------------- | |
| # conversions to strings | |
| #------------------------------------------------- | |
| # datetime object to string | |
| dt_obj = datetime(2008, 11, 10, 17, 53, 59) | |
| date_str = dt_obj.strftime("%Y-%m-%d %H:%M:%S") |
| # lib/tasks/db.rake | |
| namespace :db do | |
| desc "Dumps the database to db/APP_NAME.dump" | |
| task :dump => :environment do | |
| cmd = nil | |
| with_config do |app, host, db, user| | |
| cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
| end | |
| puts cmd |
| class PagesController < ApplicationController | |
| before_filter :login_required, :except => [ :show ] | |
| # GET /pages | |
| # GET /pages.xml | |
| def index | |
| @pages = Page.find(:all) | |
| respond_to do |format| | |
| format.html # index.html.erb |
| class UserSubscription < ActiveRecord::Base | |
| require_dependency 'user_subscription/sendhub' | |
| include UserSubscription::Sendhub | |
| attr_accessible :email, :is_active, :phone, :remind_hour, :remind_minute, :sms_id | |
| belongs_to :user | |
| before_validation :normalize_phone | |
| def normalize_phone |