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 / error.md
Created March 31, 2016 10:46
Tests on plots2
Loaded suite /home/ananyo/.rvm/gems/ruby-2.1.2/gems/rake-10.5.0/lib/rake/rake_test_loader
Started
E
================================================================================================================================================
Error: test_should_not_save_comment_without_body(DrupalCommentTest): ActiveRecord::StatementInvalid: SQLite3::ConstraintException: NOT NULL constraint failed: comments.thread: INSERT INTO "comments" ("uid", "nid", "status", "comment") VALUES (1, 1, 1, 'This thing is rad.')
================================================================================================================================================
E
================================================================================================================================================
Error: test_should_scan_callouts_out_of_body(DrupalCommentTest): ActiveRecord::StatementInvalid: SQLite3::ConstraintException: NOT NULL constraint failed: comments.thread: INSERT INTO "comments" ("uid", "nid",
@ananyo2012
ananyo2012 / typeahead_example.js
Last active July 3, 2016 05:52
Typeahead example
$('#questions_searchform_input').typeahead({
items: 15,
minLength: 3,
source: function (query, process) {
return $.post('/questions_search/typeahead/' + query, {}, function (data) {
return process(data);
})
},
updater: function(item) {
var url;
@ananyo2012
ananyo2012 / database.yml
Created July 3, 2016 06:44
Rails database.yml example
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username:
password:
socket: /var/run/mysqld/mysqld.sock
development:
<<: *default
@ananyo2012
ananyo2012 / jQuery_get.js
Created July 3, 2016 06:48
Sample snippet for jQuery.get() method
$.get('https://mapknitter.org/feeds/author/waren', function (feed) {
// processing code goes here
})
@ananyo2012
ananyo2012 / rss_snippet_1.js
Created July 3, 2016 06:50
Code snippet for parsing rss feed
$.each($(feed).find('channel item'), function (i, item) {
title = $(item).find('title').html(),
description = $(item).find('description').html();
// Rendering code goes here
})
@ananyo2012
ananyo2012 / rss_snippet_2.js
Created July 3, 2016 06:52
Code snippet for fetching content of rss feed
$('#maps table').append('<tr class="feed-item-' + i '"></tr>');
var itemEl = $('#maps table .feed-item-' + i);
itemEl.append('<tr class="title"></tr>');
itemEl.find('.title').html(title);
itemEl.append('<tr class="description"></tr>');
itemEl.find('.description').html(description);
@ananyo2012
ananyo2012 / search_query.rb
Created July 3, 2016 06:56
Ruby code for simple Search query
@notes = DrupalNode.where(
'type = "note" AND node.status = 1 AND title LIKE ?',
"%" + params[:id] + "%"
)
.joins(:drupal_tag)
.where('term_data.name LIKE ?', 'question:%')
.order('node.nid DESC')
.page(params[:page])
$ python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/ananyo/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/ananyo/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 303, in execute
    settings.INSTALLED_APPS
  File "/home/ananyo/.local/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
@ananyo2012
ananyo2012 / jasmine_spec.js
Created December 31, 2016 16:55
Sample jasmine test
describe("A suite", function() {
it("contains spec with an expectation", function() {
expect(true).toBe(true);
});
});
@ananyo2012
ananyo2012 / unlike.html
Created January 1, 2017 04:26
jasmine fixture
<ul class="btn-group">
<li rel="tooltip" title="Helpful? Like it and get updates!" class="btn btn-default btn-sm btn-like" node-id="1" id="like-button-1"><span id="like-star-1" class="fa fa-star"></span> <span id="like-count-1">1</span></li>
</ul>
<script>
jQuery(document).ready(function() {
$('#like-button-1').on('click', clickliked);
})