Skip to content

Instantly share code, notes, and snippets.

View abodacs's full-sized avatar

Abdullah Mohammed abodacs

View GitHub Profile
@abodacs
abodacs / CheatSheet.java
Created November 11, 2012 10:41 — forked from romannurik/CheatSheet.java
Android helper class for showing cheat sheets (tooltips) for icon-only UI elements on long-press. This is already default platform behavior for icon-only action bar items and tabs. This class provides this behavior for any other such UI element.
/*
* Copyright 2012 Roman Nurik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
<!DOCTYPE>
<html>
<head>
<title>Dissecting Gmail's Email Attachments - Dropping Files</title>
<style>
.msg {
display: none
}
.dragging .msg {
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
@abodacs
abodacs / async-css-&-fonts-loader.js
Created April 11, 2016 09:07 — forked from JustFly1984/async-css-&-fonts-loader.js
Async CSS and Fonts DOM injection ES6 library
/*
* Whole module based on https://github.com/filamentgroup/loadCSS library
*/
/*
* Object with all css file hrefs with proper hash for cache invalidation,
* for all pages, made by Gulp from manifest.json at build time.
*/
import { css } from "./manifest-json/css.js";
@abodacs
abodacs / forms.py
Last active May 23, 2016 17:17 — forked from neara/forms.py
Django Class Based Views and Inline Formset Example
from django.forms import ModelForm
from django.forms.models import inlineformset_factory
from models import Sponsor, Sponsorship
class SponsorForm(ModelForm):
class Meta:
model = Sponsor
@abodacs
abodacs / External Tools.xml
Created August 2, 2016 10:24 — forked from dArignac/External Tools.xml
PyCharm flake8 (~/PyCharm40/config/tools)
<toolSet name="External Tools">
<tool name="flake8 File" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="true" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
<exec>
<option name="COMMAND" value="/usr/bin/flake8" />
<option name="PARAMETERS" value="--max-line-length=160 --ignore=E501,E128 --exclude=migrations $FileDir$/$FileName$" />
<option name="WORKING_DIRECTORY" value="$FileDir$" />
</exec>
<filter>
<option name="NAME" value="Flake8 Output Filter" />
<option name="DESCRIPTION" />
@abodacs
abodacs / flake8.xml
Created August 2, 2016 10:24 — forked from stantonk/flake8.xml
PyCharm Flake8 Configuration XML File
<!-- Drop this in ~/Library/Preferences/PyCharm20/tools -->
<!-- make sure you set the path to flake8 executable for your machine in the COMMAND option -->
<?xml version="1.0" encoding="UTF-8"?>
<toolSet name="Flake8">
<tool name="Flake8 File" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="false" disabled="false" useConsole="true" synchronizeAfterRun="true">
<exec>
<option name="COMMAND" value="/usr/local/share/python/flake8" />
<option name="PARAMETERS" value="--max-line-length=120 --ignore=E301,E302,E261,E262,W404 $FileDir$/$FileName$" />
<option name="WORKING_DIRECTORY" value="$FileDir$" />
@abodacs
abodacs / gist:a8456946970d8f8d7b49a26f7c595f69
Created May 3, 2017 22:01 — forked from ImEagle/gist:8609243
Tornado + Django models
# https://bitbucket.org/yml/dj_tornado/src/c9a11ce11d4c/dj_tornado.py
import sys
import os
import tornado.httpserver
import tornado.ioloop
import tornado.web
# django settings must be called before importing models
from concurrent.futures import ThreadPoolExecutor
from datetime import timedelta
from tornado import gen
from tornado.concurrent import run_on_executor
THREADPOOL_MAX_WORKERS = 10
THREADPOOL_TIMEOUT_SECS = 30
def onthread(function):
--- my.cnf for 5.6.35
[mysqld]
sql_mode=no_engine_substitution,no_unsigned_subtraction
default_tmp_storage_engine=MyISAM
tmpdir=/data/m/my
query_cache_size=0
query_cache_type=0
long_query_time=5
log_bin=/data/m/my/binlogs/bl