Skip to content

Instantly share code, notes, and snippets.

View behnood-eghbali's full-sized avatar
🎯
Focusing

Behnood Eghbali behnood-eghbali

🎯
Focusing
View GitHub Profile

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@behnood-eghbali
behnood-eghbali / 101_movies_query.graphql
Created December 8, 2021 15:50 — forked from jexp/101_movies_query.graphql
GraphQL Training Queries
{
movies(options: { limit: 10 }) {
title
actors {
name
}
}
}
@behnood-eghbali
behnood-eghbali / Eyeballing-This.md
Created October 3, 2021 20:11 — forked from zcaceres/Eyeballing-This.md
Understanding Binding and 'this' in Javascript by zach.dev

How to Eyeball Your ‘This’ Context in Javascript

The early programmer struggles with the Javascript keyword this. But understanding your this context is easier than it seems.

This is all about where a function is invoked. Often, early programmers worry about where the function was declared. Perhaps the function was declared in a specific file or a particular object. Surely this changes it's this!

Nope.

@behnood-eghbali
behnood-eghbali / Program.cs
Created April 12, 2021 14:58
urlify strings with/without regex (c#)
using System;
using System.Text.RegularExpressions;
namespace Urlify
{
class Program
{
static void Main(string[] args)
{
var newString = "How to make pancakes ";
@behnood-eghbali
behnood-eghbali / Program.cs
Created April 11, 2021 17:29
simple random password generator in c#
using System;
using System.Text;
public class PasswordGenerator
{
public static void Main()
{
int passwordLength = 15;
string password = GeneratePassword(passwordLength);
@behnood-eghbali
behnood-eghbali / master-javascript-interview.md
Created October 27, 2020 07:20 — forked from Geoff-Ford/master-javascript-interview.md
Eric Elliott's Master the JavaScript Interview Series
@behnood-eghbali
behnood-eghbali / composing-software.md
Created October 27, 2020 07:20 — forked from Geoff-Ford/composing-software.md
Eric Elliott's Composing Software Series

Eric Elliott's "Composing Software" Series

A collection of links to the excellent "Composing Software" series of medium stories by Eric Elliott.

Edit: I see that each post in the series now has index, previous and next links. However, they don't follow a linear flow through all the articles with some pointing back to previous posts effectively locking you in a loop.

// Generic Partial Application Function
// https://jsbin.com/biyupu/edit?html,js,output
// https://gist.github.com/ericelliott/f0a8fd662111ea2f569e
// partialApply(targetFunction: Function, ...fixedArgs: Any[]) =>
// functionWithFewerParams(...remainingArgs: Any[])
const partialApply = (fn, ...fixedArgs) => {
return function (...remainingArgs) {
return fn.apply(this, fixedArgs.concat(remainingArgs));
};
@behnood-eghbali
behnood-eghbali / secret.js
Created October 27, 2020 07:08 — forked from ericelliott/secret.js
Secret - creates closures with secret messages. https://jsbin.com/hitusu/edit?html,js,output
// Secret - creates closures with secret messages.
// https://gist.github.com/ericelliott/f6a87bc41de31562d0f9
// https://jsbin.com/hitusu/edit?html,js,output
// secret(msg: String) => getSecret() => msg: String
const secret = (msg) => () => msg;
test('secret', assert => {
const msg = 'secret() should return a function that returns the passed secret.';
const getSecret = (secret) => {
return {
get: () => secret
};
};
test('Closure for object privacy.', assert => {
const msg = '.get() should have access to the closure.';
const expected = 1;
const obj = getSecret(1);