Skip to content

Instantly share code, notes, and snippets.

View BrandonMathis's full-sized avatar
🌸
me like code

BrandonMathis BrandonMathis

🌸
me like code
View GitHub Profile
@patwadeepak
patwadeepak / App.js
Created July 23, 2021 07:22
The Context Way - All Files
import Posts from "./Components/Posts";
import PostForm from "./Components/PostForm";
import { useEffect, createContext, useReducer } from "react";
const appReducer = (state, action) => {
switch (action.type) {
case "FETCH_POSTS":
return [...state, ...action.payload];
case "NEW_POST":
return [action.payload, ...state];
@scottburton11
scottburton11 / gist:3222152
Created August 1, 2012 00:58
Audio Compression for Voiceover

About compression

Audio compression is used to reduce the dynamic range of a recording. Dynamic range is the difference between the loudest and softest parts of an audio signal. It was originally used to guard against defects when cutting wax and vinyl phonograph records, but generally became useful as a way of increasing the loudness of an audio recording without achieving distortion.

The goal of most compression applications is to increase the amplitude of the softest parts of a recording, without increasing the amplitude of the loudest parts.

Compressor anatomy

Compressors generally all have the same conceptual parts. However, not all compressors present variable controls for all parts to the user. If you don't see all of your compressor's controls here, there's a chance it either has a fixed value (and no control), or is named something else:

class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@mauriciomdea
mauriciomdea / colored_logger.rb
Created December 24, 2011 08:16 — forked from romanbsd/colored_logger.rb
Color logging for Mongoid
require 'logger'
class ColoredLogger < Logger
WHITE = "\e[37m"
CYAN = "\e[36m"
MAGENTA = "\e[35m"
BLUE = "\e[34m"
YELLOW = "\e[33m"
GREEN = "\e[32m"
RED = "\e[31m"
BLACK = "\e[30m"
@iandexter
iandexter / this-package.spec
Created May 11, 2011 09:49
Skeleton SPEC file
%define _topdir /home/username/builds
%define _sourcedir %{_topdir}/SOURCES
%define _builddir %{_topdir}/BUILD
%define logmsg logger -t %{name}/rpm
Name: this-package
Version: 1.0
Release: 0.1%{?dist}
Summary: Summary goes here
@dougalcorn
dougalcorn / gist:732472
Created December 7, 2010 21:44
parse an xsd and pull out our complext types that extend "Entity"
filename = Rails.root.join("2-XML Schema", "[OSA-EAI-CCOM-ML-XSD-V03-2]CCOM-ML_V3-2-3 (2010-11-30).xsd")
doc = Nokogiri::XML(File.read(filename))
def complex_types_of(doc,base)
hash = {}
doc.xpath("//xs:extension[@base='#{base}']").each do |extension|
complex_type = extension.parent.parent
name = complex_type[:name]
hash[name] = complex_types_of(doc,name)
end