Skip to content

Instantly share code, notes, and snippets.

View jerinisready's full-sized avatar
💭
A catalyst of Change

JK jerinisready

💭
A catalyst of Change
View GitHub Profile
GET REVERSE URL NAME OF CURRENT URL : request.resolver_match.url_name # "index"
GET REVERSE VIEW NAME OF CURRENT URL : request.resolver_match.view_name # "dashboard:index"
{% verbatim %}
{{if dying}}Still alive.{{/if}}
{% endverbatim %}
class CenterRegistrationCreateForm(BootstrapMPNodeForm):
"""
This form is used by super admin for first time creation.
"""
description = forms.CharField(max_length=500)
governed_by = forms.ModelChoiceField(GoverningBody.super_manager, empty_label=settings.EMPTY_LABEL, required=True)
# TODO: district foreign key dropdown (should depend on the state selected ?)
@jerinisready
jerinisready / postgres_sql_collection.sql
Last active November 21, 2018 09:06
Postgresql Quick Refer Collection. [Generate SQL's For Altering Ownership for all table] [psql: FATAL: role "user" is not permitted to log in]
# Generate SQLs For Altering Ownership for all table
SELECT 'ALTER TABLE '|| schemaname || '.' || tablename ||' OWNER TO ipc_user;'
FROM pg_tables WHERE NOT schemaname IN ('pg_catalog', 'information_schema')
ORDER BY schemaname, tablename;
# TO PERMIT LOGIN
# issue : 'psql: FATAL: role "user" is not permitted to log in'
@jerinisready
jerinisready / python_mysql.sh
Last active May 27, 2020 09:20
some thing to setup and debug Regarding mysql in ubuntu iusing python
sudo apt-get install python-pip python-dev libmysqlclient-dev
sudo /etc/init.d/mysql stop
# FIX AGAINST CHANGED PASSWORD AUTHENTICATION METHOD. SETTING THAT TO 'mysql_native_password'
sudo mysqld_safe --skip-grant-tables &
# if that didnt work well,
@jerinisready
jerinisready / identify_browsers.js
Last active July 19, 2018 23:10
Identify the Browsers
function isIE9() {
return navigator.appName.indexOf('Internet Explorer') !== -1 && navigator.appVersion.indexOf("MSIE 9") !== -1;
}
function isIE10() {
return navigator.appName.indexOf('Internet Explorer') !== -1 && navigator.appVersion.indexOf("MSIE 10") !== -1;
}
function isOldIE() {
return isIE9() || isIE10();
@jerinisready
jerinisready / AngularJS_to_VueJS.md
Last active December 3, 2019 09:35
VueJS alternative Directives instead of Angular JS Directives. [ Helpful when manually converting form AngularJS to VueJS ]

Its Easy to Integrate VueJS with Any Other JS Frameworks. Here is some common directives and event handlers which acts similar on AngularJS / VueJS When you have a requirement to convert angular 1 Project to vuejs, this might help as a reference doc

Creating A VueJS Element.

  <script type="text/javascript">
    var vueApp = new Vue({
        el: '#selector',

data: {

@jerinisready
jerinisready / bypass_djagno_cors.py
Last active July 20, 2018 10:57
This is how I bypassed CORS for jQuery in an AMO plugin over some Django Project.
# pip install django-cors-header
# settings.py
INSTALLED_APPS = [
...
...
'corsheaders',
...
@jerinisready
jerinisready / multi_browser_compatable.js
Last active July 18, 2018 18:18
In order to accesas Browser specific API's different browsers use different API's Edge : window.msBrowser Firefox : window.browser [ though support other, prefered one is this ] Chrome : window.chrome We can make a common api call which supports on all the 3 browsers.
window.browser = (function () {
return window.msBrowser || window.browser || window.chrome;
})();
/**
*
@jerinisready
jerinisready / make_all_blocks_equiheight.js
Created July 18, 2018 05:53
How to make All Blocks Equal height with JS. **[ Courtsy: Unknown ]**
$(document).ready(function(){
$('.height-outer').each(function(){
var highestBox = 0;
$('.equilheight', this).each(function(){
if($(this).height() > highestBox) {
highestBox = $(this).height();
}
});
$('.equilheight',this).height(highestBox);
});