Skip to content

Instantly share code, notes, and snippets.

View dimagimburg's full-sized avatar

Dima Gimburg dimagimburg

View GitHub Profile
@dimagimburg
dimagimburg / StrategyPattern.swift
Last active August 23, 2018 07:23
An example of simple implementation of Strategy Pattern to validators
// for quick demonstation and run paste this code in here: http://online.swiftplayground.run
import Foundation
class ValidatorContext {
var strategy: ValidatorStrategy
var isValid: Bool {
get {
return self.validationResult?.valid ?? false
}
@dimagimburg
dimagimburg / header-body-footer-flex-layout.html
Last active November 28, 2017 10:08
take the advantage of flex in order to create simple column layout for web applications
@dimagimburg
dimagimburg / play_sine_swift3.swift
Created May 23, 2017 21:30
plays sine wav programmatically with swift 3
import UIKit
import AudioKit
import AVFoundation
class ViewController: UIViewController {
var ae:AVAudioEngine?
var player:AVAudioPlayerNode?
var mixer:AVAudioMixerNode?
var buffer:AVAudioPCMBuffer?
@dimagimburg
dimagimburg / vibash
Created May 1, 2017 10:04
A bash script that helps me automate creating executable bash shell scripts
#!/usr/bin/env bash
FILENAME=$1
if [ $# -ne 1 ]
then
echo "Usage: vibash FILENAME"
exit
fi
if [ "${FILENAME##*.}" != "sh" ]
@dimagimburg
dimagimburg / portsf_boilerplate.c
Last active November 16, 2016 21:36
C portsf library sound processing boilerplate with few examples of pan structure and function, taken from the great book "The Audio Programming Book"
/* Copyright (c) 2009 Richard Dobson
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
@dimagimburg
dimagimburg / shearsort-inneroddevensort-mpi.cpp
Last active September 9, 2016 18:14
A code snippet that uses MPI (over MPICH 1.4.1p1) to sort a N*N matrix using N*N processes
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define NUMBER_OF_PROC_IN_DIM 4
#define NUMBERS_RANGE_MAX 31
/*
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Auth Callback</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/callback_spotify.js"></script>
<style>
body{
$(document).ready(function () {
var spotify_token = localStorage.getItem('spotify_token');
if(localStorage.getItem('spotify_token')){
setSpotifyDetails(spotify_token);
}
$('.spotify-login-button').click(function(){
handleSpotifyConnect();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Auth Login</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<style>
.container{