Skip to content

Instantly share code, notes, and snippets.

View JoshuaRamirez's full-sized avatar

Joshua Ramirez JoshuaRamirez

View GitHub Profile
@JoshuaRamirez
JoshuaRamirez / BindDirective.ts
Created August 2, 2023 22:36
Bind Directive to perform true Two-Way Data-Binding in Angular
import {Directive, EventEmitter, forwardRef, HostListener, Input, Output} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from "@angular/forms";
@Directive({
selector: '[Bind]',
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => BindDirective),
multi: true,
@JoshuaRamirez
JoshuaRamirez / 0_reuse_code.js
Created December 21, 2015 21:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@JoshuaRamirez
JoshuaRamirez / main.js
Created May 2, 2013 22:02
A nice way to use the same requirejs 'main' entry point file.
var screenName = $("html").data("screen");
requirejs(
["ClientApp/Boosters/" + screenName + "App"],
function (application) {
$(document).ready(application.Boost);
}
);
@JoshuaRamirez
JoshuaRamirez / AppBus.js
Last active December 16, 2015 21:21
A super simple and easy to use Bus.
//The Bus module:
//========================
var makeBus = function () {
var subscribers = {};
var subscriptions = [];
var makeDeliveryJob = function (client) {
return function (event) {
client.Receive(event);
define(
["widget", "hoozitFactory"],
function widgetFactory(widget, hoozitFactory){
return {
create:function() {
var hoozit = hoozitFactory.create();
widget.hoozit = hoozit;
widget.initSomethingBasedOnCurrentTime();
widget.initSomethingBasedOnCurrentSomeOtherThing();
widget.andOtherThings();