Skip to content

Instantly share code, notes, and snippets.

View saadbinakhlaq's full-sized avatar
🕴️
up

Saad saadbinakhlaq

🕴️
up
View GitHub Profile
>>> class Parent(object):
... def __init__(self, name, age):
... self.name = name
... self.age = age
... def rep(self):
... print self.name
... print self.age
>>> class Child(Parent):
<Response>
<GetDigits action="http://example.com/get_digits_test/" method="GET">
<Speak>Please enter your 4-digit pin number, followed by the hash key</Speak>
</GetDigits>
<Speak>Input not received. Thank you</Speak>
</Response>
app.route('/get_digits/', methods=['GET'])
def get_digits():
if not digits:
res = plivo.Response()
get_digits = plivo.GetDigits(action='http://162.209.56.40:5006/get_digits_test/
method='GET')
get_digits.addSpeak(body='Press one for sales, press two for support')
res.add(get_digits)
return Response(str(res), mimetype='text/xml')
elif digits == '1':
#from beetle_simulation import *
import random
import csv
import numpy as np
def make_array(n, m):
'''(int, int) -> list of NoneType
Creates and returns an n by m list, filled with None.'''
array = [0] * n
(master)~/Projects/flask-sockets-tutorial$ gunicorn --worker-class socketio.sgunicorn.GeventSocketIOWorker main:app
2014-05-12 17:50:28 [4666] [INFO] Starting gunicorn 18.0
2014-05-12 17:50:28 [4666] [INFO] Listening at: http://127.0.0.1:8000 (4666)
2014-05-12 17:50:28 [4666] [INFO] Using worker: socketio.sgunicorn.GeventSocketIOWorker
2014-05-12 17:50:28 [4670] [INFO] Booting worker with pid: 4670
* Restarting with reloader
2014-05-12 17:50:29 [4671] [INFO] Starting gunicorn 18.0
2014-05-12 17:50:29 [4671] [ERROR] Connection in use: ('127.0.0.1', 8000)
2014-05-12 17:50:29 [4671] [ERROR] Retrying in 1 second.
2014-05-12 17:50:30 [4671] [ERROR] Connection in use: ('127.0.0.1', 8000)
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8

Keybase proof

I hereby claim:

  • I am saadbinakhlaq on github.
  • I am saadbinakhlaq (https://keybase.io/saadbinakhlaq) on keybase.
  • I have a public key whose fingerprint is 2B7E 6109 4E94 B83D BC62 3902 F943 309E 2035 426C

To claim this, I am signing this object:

<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.body-container {
height: 1500px;
}
.navbar-fixed-top {
@saadbinakhlaq
saadbinakhlaq / attachment.rb
Created May 21, 2016 08:52 — forked from madwork/attachment.rb
Polymorphic attachments with CarrierWave and nested_attributes
class Attachment < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader
# Associations
belongs_to :attached_item, polymorphic: true
# Validations
validates_presence_of :attachment
Dir[File.dirname(__FILE__) + '/application/*.rb'].each { |file| require file }
class KV
attr_reader :hash
def initialize
@hash = Hash.new { |h, k| h[k] = {} }
end
def set(key, value)
@hash[key][Time.now.to_i] = value