Skip to content

Instantly share code, notes, and snippets.

View ananyo2012's full-sized avatar
🎯
Focusing

Ananya Maiti ananyo2012

🎯
Focusing
View GitHub Profile
@ananyo2012
ananyo2012 / node_shared.rb
Created January 3, 2017 04:04
Node Shared Concern
module NodeShared
extend ActiveSupport::Concern
def likes
self.cached_likes
end
def liked_by(uid)
self.likers.collect(&:uid).include?(uid)
end
@ananyo2012
ananyo2012 / node.rb
Created January 3, 2017 04:14
Node model
class Node < ActiveRecord::Base
include NodeShared # This includes the NodeShared Concern
attr_accessible :title, :uid, :status, :type, :vid, :cached_likes, :comment, :path, :slug
self.table_name = 'node'
self.primary_key = 'nid'
has_many :node_selections, :foreign_key => :nid
has_many :answers, :foreign_key => :nid
@ananyo2012
ananyo2012 / test.rake
Created January 3, 2017 16:39
Custom rake task
# rake test:all
namespace :test do
desc "Run rails and jasmine tests"
task :all do
puts "Running Rails tests"
Rake::Task["test"].execute
puts "Running jasmine tests headlessly"
Rake::Task["spec:javascript"].execute
end
end
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="AdminControllerTest" tests="32" time="2.978786315" failures="1" errors="0" skipped="0" assertions="111" timestamp="2017-06-16T22:59:34+05:30">
<testcase name="test_admin_should_demote_moderator_role_to_basic" time="0.548260567" assertions="2">
</testcase>
<testcase name="test_admin_should_promote_user_role_to_admin" time="0.038366581" assertions="2">
</testcase>
<testcase name="test_admin_should_promote_user_role_to_moderator" time="0.040179291" assertions="2">
</testcase>
<testcase name="test_admin_user_should_be_able_to_mark_a_node_as_spam" time="0.181041467" assertions="8">
</testcase>
@ananyo2012
ananyo2012 / 9-2-2017-minutes.md
Created September 2, 2017 08:42
PyConf Hyderabad 2017 Minutes of Meeting - 2nd Sept, 2017

PyConf Hyderabad 2017

Minutes of Meeting - 2nd Sept, 2017

Venue

  • Ramesh looking after Venue
  • Dean confirmation required
  • Look for other options - JNTU, Golconda Hotel
  • Talk to Sharath regarding other places

PyConf Hyderabad 2017

Minutes of Meeting - 9th Sept, 2017

Venue

  • Meetup room confirmed - Room No 301, 2nd Floor, Vindhya A3 Block
  • Check with T-Hub for Workshop Venue
  • Pending : IIIT Hyderabad venue confirmation
@ananyo2012
ananyo2012 / install_badgeyay_rpm.sh
Last active October 4, 2017 14:31
Install dependencies for Badgeyay in Fedora/CentOS
sudo -i
dnf install librsvg2 librsvg2-tools
dnf install gcc gcc-c++ libXrandr gtk2 libXtst libart_lgpl
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/libgcj-4.4.7-18.el6.x86_64.rpm
wget https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-1.el6.x86_64.rpm
rpm -ivh --nodeps libgcj-4.4.7-11.el6.x86_64.rpm
rpm -i pdftk-2.02-1.el6.x86_64.rpm
exit
magudi-master/.gitignore
magudi-master/Readme.md
magudi-master/Vagrantfile
magudi-master/pillar/
magudi-master/pillar/junction.sls
magudi-master/pillar/pycon.sls
magudi-master/pillar/pycon_mail.sls
magudi-master/pillar/pythonexpress.sls
magudi-master/pillar/pythonexpress_mail.sls
magudi-master/pillar/top.sls
@ananyo2012
ananyo2012 / client.py
Last active August 19, 2018 07:03
Simple Socket Programming
# A simple Client Program for making requests using socket
import socket
s = socket.socket()
# The socket listens to a specific port
port = 12345
# Connect to the server
@ananyo2012
ananyo2012 / http-requests.ipynb
Last active August 4, 2018 17:54
Making HTTP Requests in python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.