Skip to content

Instantly share code, notes, and snippets.

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

Marcell Mazuh

👨‍💻
Code Summoner
View GitHub Profile
@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
@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++) {
port module Spelling exposing (..)
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import String
main =
@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;
@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
@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
@yying
yying / volume_meter.html
Created January 29, 2015 17:02
WebAudio volume meter using a MediaStream (can be easily applied to MediaStream from WebRTC)
<!DOCTYPE html>
<html lang="en">
<head>
<title> </title>
<link rel="stylesheet" type="text/css" href="http://cdn.jsdelivr.net/min/1.5/min.min.css">
<style>
body,textarea,input,select {
background:0;
border-radius:0;
font:16px sans-serif;
@koistya
koistya / App.js
Last active June 8, 2022 09:55
How to add `onscroll` event in ReactJS component
import React from 'react';
let lastScrollY = 0;
let ticking = false;
class App extends React.Component {
componentDidMount() {
window.addEventListener('scroll', this.handleScroll, true);
}
var path = require('path')
var childProcess = require('child_process')
var phantomjs = require('phantomjs')
var nodemailer = require("nodemailer");
// create reusable transport method (opens pool of SMTP connections)
var smtpTransport = nodemailer.createTransport("SMTP",{
service: "Gmail",
auth: {
user: "br****@gmail.com",

THIS DOCUMENT

IS OUT OF

DATE

C++ Coding Standards Part 0: Automated Code Analysis

Automated analysis is the main advantage to working with a modern statically typed compiled language like C++. Code analysis tools can inform us when we have implemented an operator overload with a non-canonical form, when we should have made a method const, or when the scope of a variable can be reduced.