Skip to content

Instantly share code, notes, and snippets.

View jobelenus's full-sized avatar

John Obelenus jobelenus

View GitHub Profile
if (identityUser.mobile == participantNum) {
console.log('identity does exist')
const participantEntry = new SideChatParticipants(participant)
// eslint-disable-next-line no-return-await
try {
return await participantEntry.save()
} catch(err) {
console.log(err)
return false // or -1, or something you can check for your error condition, or even re-reaise `err`
}
> PROJECT_NOTES.md
echo "# AUTOMATED NOTE COLLECTOR" >> PROJECT_NOTES.md
leasot -r markdown -S --tags XXX BUG */*.py */*/*.py */templates/* */templates/*/* */static/js/* */static/scss/* assets/js/* >> PROJECT_NOTES.md
git add PROJECT_NOTES.md
// Getting defaultdict from Python in JS
class DefaultDict extends Object {
constructor(defaultInit) {
return new Proxy({}, {
get: (target, name) => name in target ?
target[name] :
(target[name] = typeof defaultInit === 'function' ?
new defaultInit().valueOf() :
defaultInit)
})
@jobelenus
jobelenus / TestPass.elm
Created November 24, 2018 20:27
Working on elm
import Browser
import Html exposing (Html, Attribute, div, input, text)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import Regex exposing (..)
main =
Browser.sandbox
{ init = init
@jobelenus
jobelenus / example.py
Last active June 12, 2018 21:57
How to get a set of KNOWN_GOOD
class SourceDimension(models.Model):
source_id = models.IntegerField(db_index=True)
name = models.CharField(max_length=256, db_index=True)
category = models.CharField(max_length=128, default='')
fuzz_grouped_source_name = models.CharField(max_length=256, default='')
fuzz_ratio = models.PositiveIntegerField(default=0)
KNOWN_GOOD = [
# These are first on purpose
'Edmunds CarCode', 'Edmunds Price Promise', 'TrueCar/USAA',
@jobelenus
jobelenus / lead_fix.py
Created May 15, 2018 21:46
What I just did as the final fix
# STEP 1 REMOTE
import datetime
before = datetime.date(2018, 5, 15)
after = datetime.date(2018, 5, 1)
from shelby.models import Lead
qs = Lead.objects.filter(created_on__date__lt=before, created_on__date__gte=after, status=Lead.STATUS_NEW).values_list('id', flat=True)
for lead_id in qs:
print(lead_id) # copy that output into "new_leads.txt"
addFoo(e, target_variable){
if(e.target.checked){
this.setState({
show: [...this.state.show, target_variable]})
}else{
var index = this.state.show.indexOf('target_variable');
if (index > -1) {
this.state.show.splice(index, 1);
this.setState({
show: [...this.state.show,]})
xml = """<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
<?adf version="1.0"?>
<adf>
<prospect status="new">
...
</prospect>
</adf>
"""
from bs4 import BeautifulSoup
@jobelenus
jobelenus / websockets-best-practices.md
Last active March 8, 2023 06:52
Websockets with Django - Best Practices

John Obelenus, jobelenus@activefrequency.com

Websockets are basically the same sockets you used in your college programming courses.

Base websocket class

class BaseJsonWebsocketConsumer(JsonWebsocketConsumer):

    def send(self, content, close=False):
        """
@jobelenus
jobelenus / cards.js
Created May 26, 2016 22:39
Working JS under Node
#!/usr/bin/env node
var util = require('util');
console.log('start');
var A = 14;
var K = 13;
var Q = 12;