Skip to content

Instantly share code, notes, and snippets.

View joe-crick's full-sized avatar

Joe Crick joe-crick

View GitHub Profile
:root {
/* COLORS */
/* Alerts */
--alert-red: maroon;
--warning-yellow: darkyellow;
--success-green: green;
--error-red: red;
@joe-crick
joe-crick / react-intl.msg.json
Last active September 25, 2018 08:16
React-intl test
{
"locale":"de",
"messages":{
"common":{
"more":"{count} weitere anzeigen",
"confirmButton":"Bestätigen",
"genericError":"Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.",
"proceed":"Weiter",
"cancel":"Abbrechen",
"save":"Speichern",
;; with parens
(defn symmetrize-body-parts
"Expects a seq of maps that have a :name and :size"
[asym-body-parts]
(loop [remaining-asym-parts asym-body-parts
final-body-parts []]
(if (empty? remaining-asym-parts)
final-body-parts
(let [[part & remaining] remaining-asym-parts]
(recur remaining
@joe-crick
joe-crick / example.c
Created September 7, 2018 07:15
A Computer can Understand This
#include<stdio.h>
int a = 256;int main(){for(char b[a+a+a],
*c=b ,*d=b+ a ,*e=b+a+a,*f,*g=fgets(e,(b[
a]=b [a+a] =a- a,a) , stdin);c[0]=a-a,f=c
,c=d ,d=e ,e=f, f= g,g =0,g = fgets(e,a+a
-a+ a -a+a -a+ a- +a,stdin ),f +a-a ; pu\
tchar(+10)) { for( int h= 1,i=1,j, k=0 ,l
=e[0]==32,m,n=0,o=c [ 0]== 32, p, q=0;d[q
];j=k,k=l,m=n,n=o,p=(j)+(k* 2 )+(l =(i =
e[ q]&&i ) &&e[q +1 ]== 32,l*4)+(m* 8 )+(
const getContactById = contactId => fetch(`https://jsonplaceholder.typicode.com/contacts/${contact.id}`);
const setContactData = (data, state) => {
data.fullName = `${data.firstName} ${data.lastName}`
return {
currentContact: data,
actionSuccess: true,
masterContactAlert: data.contactId === state.masterContact.id
}
};
// ****** Action ********
import { asyncUpdate } from "reduxigen";
export const getContacts = asyncUpdate(
"contacts",
(orgId, costCenter) => fetch(`https://jsonplaceholder.typicode.com/users?orgId=${orgId}&cc=${costCenter}`),
contacts => ({
contacts
})
);
Operation TrieSearch Array
Initialization Must be configured for searching specific data. Does not have to be configured for search.
Searching Exposes a get method. You must write a filter for each type of query.
// Segment Tree
getSmallestBidFromRange() {
const start = parseInt(this.start);
const end = parseInt(this.end);
this.smallestValue = this.segmentTree.rangeMinQuery(start, end);
}
// Array
getSmallestBidFromRange() {
const start = parseInt(this.start);
mounted() {
this.segmentTree = new SegmentTree(this.items, true, "bid");
},
methods: {
getSmallestBidFromRange() {
const start = parseInt(this.start);
const end = parseInt(this.end);
this.smallestValue = this.segmentTree.rangeMinQuery(start, end);
},
getSumFromRange() {
methods: {
getSmallestBidFromRange() {
const start = parseInt(this.start);
const end = parseInt(this.end);
this.smallestValue = this.items
.filter(bidsInRange(start, end))
.reduce((cur, prev) => {
if (prev) {
return cur;
} else {