Skip to content

Instantly share code, notes, and snippets.

View annielagang's full-sized avatar

Annielyn May Lagang annielagang

  • Cavite, Philippines
View GitHub Profile
@jnizet
jnizet / confirm-modal-and-service.ts
Last active October 27, 2022 16:54
How to create a reusable service allowing to open a confirmation modal from anywhere with ng-bootstrap
import { Component, Injectable, Directive, TemplateRef } from '@angular/core';
import { NgbModal, NgbModalRef, NgbModalOptions } from '@ng-bootstrap/ng-bootstrap';
/**
* Options passed when opening a confirmation modal
*/
interface ConfirmOptions {
/**
* The title of the confirmation modal
*/
@evanwill
evanwill / gitBash_windows.md
Last active May 29, 2024 11:03
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@ezarko
ezarko / jQuery.reduce.js
Last active March 14, 2018 01:25
A jQuery reduce function which returns a proper collection object. Note that callback is called with DOM nodes that will need to be $()'d if needed.
$.fn.reduce = function() {
return (arguments.length > 1 || this.length) ? $([].reduce.apply(this.toArray(), arguments)) : this;
};
@ankitbko
ankitbko / prayer.txt
Last active November 14, 2023 01:07
Programmer's Prayer
Our program, who art in memory,
called by thy name;
thy operating system run;
thy function be done at runtime
as it was on development.
Give us this day our daily output.
And forgive us our code duplication,
as we forgive those who
duplicate code against us.
And lead us not into frustration;
@devbyray
devbyray / domIsReady.js
Last active November 13, 2023 17:46
Vanilla JavaScript Document Ready (Cross-Browser)
var domIsReady = (function(domIsReady) {
var isBrowserIeOrNot = function() {
return (!document.attachEvent || typeof document.attachEvent === "undefined" ? 'not-ie' : 'ie');
}
domIsReady = function(callback) {
if(callback && typeof callback === 'function'){
if(isBrowserIeOrNot() !== 'ie') {
document.addEventListener("DOMContentLoaded", function() {
return callback();
@vkhorikov
vkhorikov / CustomerController.cs
Last active May 25, 2024 19:53
Handling failures and input errors in a functional way
[HttpPost]
public HttpResponseMessage CreateCustomer(string name, string billingInfo)
{
Result<BillingInfo> billingInfoResult = BillingInfo.Create(billingInfo);
Result<CustomerName> customerNameResult = CustomerName.Create(name);
return Result.Combine(billingInfoResult, customerNameResult)
.OnSuccess(() => _paymentGateway.ChargeCommission(billingInfoResult.Value))
.OnSuccess(() => new Customer(customerNameResult.Value))
.OnSuccess(
@jpillora
jpillora / search-example.json
Last active February 3, 2022 03:08
Torrent cloud search provider specification
{
"mininova": {
"name": "Mininova",
"type": "screen-scraper",
"list": {
"url": "http://www.mininova.org/search/{query}/seeds/{page}",
"items": ".maintable > tr",
"item": {
"name":"td:nth-child(3) > a:nth-child(2)",
"url":"td:nth-child(3) > a:nth-child(2)@href",
@maxgherman
maxgherman / InfiniteStreamsCSharp.cs
Last active August 29, 2015 14:03
Haskell / Scala Infinite Streams in C#
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
@qwo
qwo / google-tips
Last active January 24, 2024 19:27
Google Recruiter Candidate Tips ..
xxx,
Thanks again for taking the time to speak with me and for sending me your information. I'm excited to tell you that we would like to move forward in the process!
One of our coordinators will be emailing you within the next week from an @google.com domain with the date and time of your phone interview. In the meantime, I've included some preparation materials (below.)
Please note this will be a technical interview that will last for approximately 45 minutes. Google takes an academic approach to the interviewing process. This means that we are interested in your thought process, your approach to problem solving as well as your coding abilities. You may be asked questions that relate to technical knowledge, algorithms, coding, performance, how to test solutions, and perhaps your interest in Google products. The best advice that I can give you is to treat the interview like a conversation, talk through the problems, and please feel free to ask the interviewer if you are not clear with any of the questio
@pmbanugo
pmbanugo / BaseRepository.cs
Last active September 26, 2023 06:46
Implementation of the Repository and UnitOfWork pattern using Entity Framework.
// License: Apache 2.0
// A generic base repository which other repositories (if needed) can inherit from
public class BaseRepository<TEntity> : IEntityRepository<TEntity> where TEntity : class
{
internal DataContext context;
internal DbSet<TEntity> dbSet;
public BaseRepository(DataContext context)
{