Skip to content

Instantly share code, notes, and snippets.

View morenoh149's full-sized avatar
💭
Working from 🛰

Harry Moreno morenoh149

💭
Working from 🛰
View GitHub Profile
@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@benbacardi
benbacardi / templatetags.py
Last active October 11, 2023 11:03
Django query_transform templatetag
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def query_transform(context, **kwargs):
'''
Returns the URL-encoded querystring for the current page,
updating the params with the key/value pairs passed to the tag.
@cburgdorf
cburgdorf / xor_keras.py
Last active November 18, 2020 11:23
Comparing XOR between tensorflow and keras
import numpy as np
from keras.models import Sequential
from keras.layers.core import Activation, Dense
training_data = np.array([[0,0],[0,1],[1,0],[1,1]], "float32")
target_data = np.array([[0],[1],[1],[0]], "float32")
model = Sequential()
model.add(Dense(32, input_dim=2, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
d = dict()
d['title_list'] = []
now = datetime.datetime.now()
base_title_qs = Title.objects.distinct().filter(state='P').order_by('stage', 'category')
if section == 'c':
base_title_qs = base_title_qs.filter(stage__id=2)
@joedougherty
joedougherty / supervisord_vs_monit.txt
Last active October 31, 2017 16:06
supervisord_vs_monit
supervisord [supervisord.org]
=============================
* Set up jobs via a config file (.ini style)
Example:
--------
[program:forever]
command=/usr/bin/python /root/supervisoreval/bin/forever.py &
numprocs=1
@Zequez
Zequez / init.coffee
Last active February 26, 2023 15:19
Comment out JSX code on Atom
# If you worked with React and JSX you probably noticed that you can't use JS comments when inside JSX sections
# Add this to your Atom init script
# Then add 'ctrl-cmd-/': 'comment-jsx' to your keymap.cson
# Then when you are on a JS/JSX file, just press cmd+ctrl+/ to use JSX-style comments that work with JSX elements
# Is not the most efficient way, but it's the cleanest and reliable one
atom.commands.add 'atom-workspace', 'comment-jsx', ->
atom.config.set('editor.commentStart', '{/*', {scopeSelector: '.source.js.jsx'})
atom.config.set('editor.commentEnd', '*/}', {scopeSelector: '.source.js.jsx'})
for selection in atom.workspace.getActiveTextEditor().selections
@t-mart
t-mart / netrw quick reference.md
Last active April 30, 2024 22:30
A quick reference for Vim's built-in netrw file selector.
Map Action
<F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file
<del> Netrw will attempt to remove the file/directory
- Makes Netrw go up one directory
a Toggles between normal display, hiding (suppress display of files matching g:netrw_list_hide) showing (display only files which match g:netrw_list_hide)
c Make browsing directory the current directory
C Setting the editing window
d Make a directory
@nrollr
nrollr / MySQL.md
Last active October 28, 2020 02:53
Install MySQL on El Capitan using Homebrew

Install MySQL on OS X El Capitan

Normally the installation of MySQL can be achieved with a single command, which executes a script provided by MacMiniVault : bash <(curl -Ls http://git.io/eUx7rg)

However, at the time of writing the script is not compatible with OS X El Capitan (10.11)

Install MySQL using Homebrew

An alternative to the aforementioned installation script is installing MySQL using Homebrew. This gist assumes you already have Homebrew installed, if not first read the article "Homebrew and El Capitan"

Make sure Homebrew has the latest formulae, so run brew update first

from django.db.models.query import QuerySet
from pprint import PrettyPrinter
def dprint(object, stream=None, indent=1, width=80, depth=None):
"""
A small addition to pprint that converts any Django model objects to dictionaries so they print prettier.
h3. Example usage
>>> from toolbox.dprint import dprint