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
@unbracketed
unbracketed / gist:228457
Created November 7, 2009 01:45
Django virtualenv postactivate hook
#I usually drop something like this into my virtualenv's postactivate for some
#quick and handy shortcuts to common Django commands.
#This way dropping in to do some work on any arbitrary project is as easy as:
# 1. workon <project name>
# 2. djr
cd /path/to/site/root
#Django command shortcuts
alias dj='python manage.py'
@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
@nicocrm
nicocrm / switchByProp.js
Last active March 26, 2018 21:43
transitionProps - a HOC to help build transitions with react-transition-group v2. Very nice with styled-components.
// build a switch function that examines a key/value collection based on an object literal,
// and return the first match
//
// Example usage:
// ```
// const result = switchBy({
// entering: 'A',
// entered: 'B',
// default: 'C'
// })(props)
@jimeh
jimeh / com.rabbitmq.rabbitmq-server.plist
Created March 24, 2011 10:47
Mac OS X launchctl plist for Homebrew-based RabbitMQ installations. Place in: ~/Library/LaunchAgents
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.rabbitmq.rabbitmq-server</string>
<key>Program</key>
<string>/usr/local/sbin/rabbitmq-server</string>
@DesignByOnyx
DesignByOnyx / postgis-geojson-liaison.js
Created November 9, 2018 00:47
Helpful utility for converting postgis data into GeoJSON as it comes out of the db, and vice versa.
var wkx = require('wkx')
var pg = require('pg')
var pgUtil = require('pg/lib/utils')
const geoParser = {
init(knex){
// 1. Convert postgis data coming out of the db into geoJSON
// Every postgres installation will have different oids for postgis geo types.
knex
.raw('SELECT oid, typname AS name FROM pg_type WHERE typname IN (\'geography\', \'geometry\');')
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
@amoilanen
amoilanen / string_search.js
Created August 2, 2011 19:13
Rabin-Karp Algorithm for Searching Strings Implemented in JavaScript
function simpleSearch(text, str) {
var matches = [];
for (var i = 0; i <= text.length; i++) {
if (matchesAtIndex(i, text, str)) {
matches.push(i);
}
}
return matches;
}
@nadesh-git
nadesh-git / gist:908b9714f9c7f20b66dfb13b49ba346a
Created June 19, 2019 11:05
React native build issue - Androidx migration (June 2019)
Reference
https://developer.android.com/jetpack/androidx/migrate
android/build.gradle:
====================
buildscript {
ext {
googlePlayServicesVersion = "16.+"
firebaseVersion = "17.3.4"
@spoike
spoike / reflux.js
Created June 29, 2014 22:23
A simpler implementation of React.JS's Flux
var EventEmitter = require('events').EventEmitter,
_ = require('lodash');
/**
* Creates an action functor object
*/
exports.createAction = function() {
var action = new EventEmitter(),
eventLabel = "action",
@erica
erica / gist:0c445044e1bf97778263
Last active February 19, 2020 13:32
#swift-lang ReadMe

"JUST BECAUSE YOU'RE USING SWIFT DOESN'T MEAN YOUR QUESTION IS ABOUT SWIFT"

How To Get Answers

Ask your question and then be patient. Tell us what you want to happen, what is actually happening, and include any error messages you find:

  • Provide a scenario. "I am trying to do X, I do so by calling APIs W and Y, but Z happens instead. I see the following error messages:..."
  • Focus on the goal. Ask about what you're trying to achieve (the big story) rather than the specific technical detail that you believe is holding you back.
  • Don't solicit help. Don't say, "Does anyone here know about (for example) Protocol Extensions". Just ask your question.
  • Do your homework. Search the web before asking in-channel.
  • Be courteous Don't just paste Stack Overflow questions in-channel.
  • Remember the topic Refer questions about third party libraries to their developers.