Skip to content

Instantly share code, notes, and snippets.

View NimaFakoor's full-sized avatar

NimaFakoor

View GitHub Profile
                             .                   ...   ..                             . .  .... 
                                                 ..    ..                                ...   .

... . ......
. .. . ....',,,,,,,'..... ......
... . .......'.. ....... . ..,;:cc:::::::::;;,,'.. .....
......... ........'..',,'..',,,'.... ....';:ccllccclllccc:;;,,,,'... ..... .. . ......... .........',,''''...''..'....... ..',:llllllolllllc:;;;;;;,,'... .
. ....... ...........''''',,'''''..... ...... ........:odddddoolllc:::;;;:;'''.... ..
. ....................'',;::cccccc:;;,'................,oxxxxddollllc:::;;;,'....... .....
......................,::ldxkkOOkkkkxxddoc:,'.... . .....:xxdddoolcccccc:::;,'..............

{
"editor.multiCursorModifier": "ctrlCmd",
"editor.snippetSuggestions": "top",
"editor.formatOnPaste": true,
"editor.fontFamily" : "Fira Code",
"editor.fontLigatures": true,
"emmet.triggerExpansionOnTab": true,
"php.suggest.basic": false,
"editor.autoIndent": true,
"emmet.includeLanguages" : {
@mozillazg
mozillazg / app.py
Created December 5, 2017 00:06
A simple demo for how to use flask-paginate.
from flask import Flask, render_template
from flask_paginate import Pagination, get_page_args
app = Flask(__name__)
app.template_folder = ''
users = list(range(100))
def get_users(offset=0, per_page=10):
@wojteklu
wojteklu / clean_code.md
Last active June 29, 2024 08:22
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@antic183
antic183 / remove-utf8-bom.js
Last active March 13, 2024 08:45
remove utf-8 bom with javascript
// remove utf-8 BOM from ressource "res"
// res.charCodeAt(0) === 0xFEFF | res.charCodeAt(0) === 65279
if (res.charCodeAt(0) === 0xFEFF) {
res = res.substr(1);
}
@CaptainFrog
CaptainFrog / db.py
Created April 28, 2016 16:00
DatabaseHandler Python
import sqlite3
class Database():
"""Database Helper class"""
def __init__(self):
self.conn = None
def connect(self, filename):
""" Connect the databse handler to a databse """
@garaud
garaud / sqlalchemy-orm-query-to-dataframe.py
Last active June 7, 2024 13:55
Example to turn your SQLAlchemy Query result object to a pandas DataFrame
# -*- coding: utf-8 -*-
"""From a Query.all(), turn this result to a pandas DataFrame
Table creation and example data come from the official SQLAlchemy ORM
tutorial at http://docs.sqlalchemy.org/en/latest/orm/tutorial.html
Just take a look at the 'query_to_dict' function and the last part of the __main__.
"""
@vkotovv
vkotovv / app.py
Created August 20, 2013 14:08
Clear data for all tables via flask-sqlalchemy
def clear_data(session):
meta = db.metadata
for table in reversed(meta.sorted_tables):
print 'Clear table %s' % table
session.execute(table.delete())
session.commit()