Skip to content

Instantly share code, notes, and snippets.

John Palgut Jwsonic

Block or report user

Report or block Jwsonic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View word_search.exs
defmodule Dictionary do
@moduledoc """
A Trie based approach to the dictionary.
https://en.wikipedia.org/wiki/Trie
"""
defstruct words: %{}
@terminatior "."
View reorder_lists.exs
defmodule ListNode do
@moduledoc """
Define a Node type for our linked list.
"""
@enforce_keys [:data, :next]
defstruct data: 0,
next: nil
end
defimpl String.Chars, for: ListNode do
View string_equations.exs
defmodule Digits do
@operators ["+", "-", "*"]
def calculate(num, target) do
# 1) Turn num into a list of characters
# 2) Build all possible equations
# 3) Filter out the ones that don't evaluate to the target
# 4) Clean up results for printing
num
@Jwsonic
Jwsonic / m+n.py
Created May 2, 2019
Python3 m+n solution
View m+n.py
#!/usr/bin/env python3
import unittest
def zero(matrix):
if len(matrix) == 0:
return matrix
rows = set()
cols = set()
View api.re
module type ApiClient = {let getFile: unit => string;};
module FakeApiClient: ApiClient = {
let getFile = () => "cat.jpg";
};
let unwrapUnsafely = data =>
switch (data) {
| Some(v) => v
| None => raise(Invalid_argument("unwrapUnsafely called on None"))
View pending.js
const money = t => parseFloat(t.trim().replace(/[^0-9\.]+/g,""));
const pending = $('#sortTable tr').toArray().reduce((acc, node) => {
const trNode = $(node);
if(trNode.find('td.date').text() === 'Pending') {
return acc + money(trNode.find('td.amount').text());
}
return acc;
View register.liquid
<div class="page-width">
<div class="grid">
<div class="grid__item medium-up--one-half medium-up--push-one-quarter">
<div class="form-vertical">
{% form 'create_customer' %}
<h1 class="text-center">{{ 'customer.register.title' | t }}</h1>
{{ form.errors | default_errors }}
@Jwsonic
Jwsonic / OffsetZ.py
Created Jan 27, 2017
Cura postprocess scripts
View OffsetZ.py
from ..Script import Script
from UM.Logger import Logger
import re
class OffsetZ(Script):
def __init__(self):
super().__init__()
def getSettingDataString(self):
View gist:4292ba49877a8fa4b11965f3964956ec
### Keybase proof
I hereby claim:
* I am jwsonic on github.
* I am jpalgut (https://keybase.io/jpalgut) on keybase.
* I have a public key whose fingerprint is 98C2 B071 BB50 80E4 4A98 CE3C FF8E D5F7 5C78 2F5C
To claim this, I am signing this object:
View npm ls
ceribell-client@1.0.0 /Users/john/workspace/ceri/ceri-client
├─┬ aws-sdk@2.4.10
│ ├── jmespath@0.15.0
│ ├── sax@1.1.5
│ ├── xml2js@0.4.15
│ └─┬ xmlbuilder@2.6.2
│ └── lodash@3.5.0
├── babel@6.5.2
├─┬ babel-core@6.11.4
│ ├─┬ babel-code-frame@6.11.0
You can’t perform that action at this time.