Skip to content

Instantly share code, notes, and snippets.

View hjoseph96's full-sized avatar

Herbert Joseph hjoseph96

  • Queens, NY
  • 11:37 (UTC -05:00)
View GitHub Profile
@lTyl
lTyl / AudioSampler.cs
Created January 1, 2022 08:48
Simple script which can be used to update the state of an object (like animation) depending on AudioSource outout
using System;
using System.Collections;
using UnityEngine;
namespace SMS.Tools
{
public class AudioSampleData
{
public float rootMeanSquared;
@markv12
markv12 / DelegateExamples.cs
Last active February 20, 2025 14:55
C# Action Func Predicate Examples
using System;
public class DelegateExamples
{
public void Run()
{
Action action1 = delegate { /*Do something*/ };
action1();
FunctionWithOnComplete(action1);
@abelorian
abelorian / agora.rb
Last active June 20, 2024 20:37
Agora dynamic Key ruby RTC example. Gem agora_dynamic_key https://rubygems.org/gems/agora_dynamic_key
# In Gemfile: gem 'agora_dynamic_key', '~> 0.1.0'
require 'dynamic_key'
class Agora
EXPIRATION_TIME_IN_SECONDS = 3600*3
def generate_rtc_token channel_name = 'any_channel_name'
params = {
@ditzel
ditzel / MathParabola.cs
Last active November 25, 2025 06:13
A simple Math class to calculate a point in 2D or 3D space lying on a parabola. And a more complex parabola controller that you can put on an object.
using UnityEngine;
using System;
public class MathParabola
{
public static Vector3 Parabola(Vector3 start, Vector3 end, float height, float t)
{
Func<float, float> f = x => -4 * height * x * x + 4 * height * x;
@nikneroz
nikneroz / Guardian JWT.md
Last active October 10, 2023 19:13
Elixir + Phoenix Framework + Guardian + JWT. This is tutorial and step by step installation guide.

Elixir + Phoenix Framework + Guardian + JWT + Comeonin

Preparing environment

We need to generate secret key for development environment.

mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf

Let's generate User model and controller.

@shiroyasha
shiroyasha / dog.rb
Created February 16, 2016 22:20
Method tracer for Ruby classes
class Dog
attr_writer :name
def initialize(name)
@name = name
end
def bark
puts "patrick"
end
@janko
janko / 01-activerecord.rb
Created May 27, 2015 22:50
PostgreSQL JSON querying in Sequel (my presentation from our local Ruby meetup)
require "active_record"
ActiveRecord::Base.establish_connection('postgres:///testing')
ActiveRecord::Migration.verbose = false
ActiveRecord::Migration.class_eval do
create_table :played_quizzes, force: true do |t|
t.integer :player_ids, array: true
t.json :quiz_snapshot
end
@voter101
voter101 / Gulpfile.js
Last active October 16, 2024 17:37
Gulpfile for Rails application with replaced Sprockets with Gulp
'use strict'
var gulp, sass, babelify, browserify, watchify, source, util;
gulp = require('gulp');
sass = require('gulp-sass');
babelify = require('babelify')
browserify = require('browserify');
watchify = require('watchify');
source = require('vinyl-source-stream');
@JonathanReid
JonathanReid / SpriteCreator
Last active April 9, 2025 07:27
SpriteCreator, a runtime atlassing system for Unity Sprites.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
/// <summary>
/// SpriteCreator, a runtime atlassing system for Unity Sprites.
/// Tries to not create any unneccessary textures, cleans all references when Flushed.
/// Can use with or without the atlassing, just call AddToAtlas and Build when using atlasses.
/// Full control over which atlases to add images to.