Skip to content

Instantly share code, notes, and snippets.

View Mazuh's full-sized avatar
👨‍💻
Code Summoner

Marcell Mazuh

👨‍💻
Code Summoner
View GitHub Profile
@ja0n
ja0n / objetos_em_javascript.md
Last active August 29, 2015 14:19
Um resumão sobre objetos em Javascript

#(Quase) Tudo que você precisa saber sobre objetos em Javascript

Roteiro

  1. Javascript é sobre objetos
  2. Declaração
  3. Propriedades e descritores
  4. Métodos e o this
  5. Notação literal
  6. Herança e protótipos
@johan-bjareholt
johan-bjareholt / Speech recognition
Created December 8, 2015 15:54
Speech recognition on linux using Google Speech API
#!/bin/bash
# Record from mic
arecord -d 3 -f cd -t wav -r 16000 -c 1 -D pulse test.wav
# Get record volume
sox test.wav -n stats -s 16 2>&1 | grep 'Max level' | awk '{print $3}'
# Convert to flac for smaller footprint
flac -f test.wav
# Google speech recognition
LANG=en-us
@gitawego
gitawego / simple-server.java
Last active December 17, 2019 02:56
simple HTTP server in Java
package com.stackoverflow.q3732109;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
port module Spelling exposing (..)
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import String
main =
@cagdass
cagdass / kmp.c
Created October 3, 2016 19:19
Knuth-Morris-Pratt algorithm implementation in C
#include <stdlib.h>
#include <string.h>
void failure(char* pattern, int* f);
int kmp(char* t, char* p);
int* init_array(int size) {
int* arr = (int*)malloc(size * sizeof(int));
int i;
for(i = 0; i < size; i++) {
@groteck
groteck / Spelling.elm
Last active February 20, 2020 18:01 — forked from evancz/Spelling.elm
Remove unused import
port module Spelling exposing (..)
import Html exposing (..)
import Html.Events exposing (..)
import String
main =
program
{ init = init
@zcaceres
zcaceres / Include-in-Sequelize.md
Last active April 2, 2025 06:07
using Include in sequelize

'Include' in Sequelize: The One Confusing Query That You Should Memorize

When querying your database in Sequelize, you'll often want data associated with a particular model which isn't in the model's table directly. This data is usually typically associated through join tables (e.g. a 'hasMany' or 'belongsToMany' association), or a foreign key (e.g. a 'hasOne' or 'belongsTo' association).

When you query, you'll receive just the rows you've looked for. With eager loading, you'll also get any associated data. For some reason, I can never remember the proper way to do eager loading when writing my Sequelize queries. I've seen others struggle with the same thing.

Eager loading is confusing because the 'include' that is uses has unfamiliar fields is set in an array rather than just an object.

So let's go through the one query that's worth memorizing to handle your eager loading.

The Basic Query

@fokusferit
fokusferit / enzyme_render_diffs.md
Last active November 5, 2025 09:57
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@avsthiago
avsthiago / bar_primeiro_bimestre.py
Last active September 15, 2020 17:24
Controle bar threads
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 24 10:15:44 2017
@author: avsthiago, asales, rtibola
"""
"""
Problema Original
http://www.inf.pucrs.br/~emoreno/undergraduate/CC/sisop/sem12.1/material/trabalhos/TP2.pdf
@codediodeio
codediodeio / database.rules.json
Last active November 9, 2025 17:54
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}