Skip to content

Instantly share code, notes, and snippets.

View AnechaS's full-sized avatar
😀
Hello

Anecha Kuekharem AnechaS

😀
Hello
  • True Digital Group
  • Thailand
  • 23:15 (UTC +07:00)
View GitHub Profile
@sikofitt
sikofitt / composer.json
Last active July 2, 2021 19:51
Guzzle promise example and Pool example
{
"name": "sikofitt/guzzle-example",
"description": "Guzzle Example",
"type": "project",
"require": {
"php":">=5.6",
"guzzlehttp/guzzle": "^6.2"
},
"require-dev": {
"symfony/var-dumper": "^3.2",
@antonmedv
antonmedv / DotNotation.php
Last active August 11, 2022 13:47
Dot notation for access multidimensional arrays.
<?php
/**
* Dot notation for access multidimensional arrays.
*
* $dn = new DotNotation(['bar'=>['baz'=>['foo'=>true]]]);
*
* $value = $dn->get('bar.baz.foo'); // $value == true
*
* $dn->set('bar.baz.foo', false); // ['foo'=>false]
*
@artem-zinnatullin
artem-zinnatullin / MyApp.java
Last active January 15, 2023 13:04
If you need to set one font for all TextViews in android application you can use this solution. It will override ALL TextView's typefaces, includes action bar and other standard components, but EditText's password font won't be overriden.
public class MyApp extends Application {
@Override
public void onCreate() {
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf
}
}
@voku
voku / DotNotation.php
Created February 4, 2016 02:03 — forked from antonmedv/DotNotation.php
Dot notation for access multidimensional arrays.
<?php
/**
* Dot notation for access multidimensional arrays.
*
* $dn = new DotNotation(['bar'=>['baz'=>['foo'=>true]]]);
*
* $value = $dn->get('bar.baz.foo'); // $value == true
*
* $dn->set('bar.baz.foo', false); // ['foo'=>false]
*
@yidas
yidas / js-nl2br-br2nl.md
Last active September 29, 2023 05:26
JavaScript nl2br & br2nl functions

JavaScript nl2br & br2nl functions

The exchange of new line & br HTML tag could refer to PHP - nl2br() function, which uses to inserts HTML line breaks before all newlines in a string.

These JavaScript functions consider whether to use insert or replace to handle the swap.

nl2br

@illepic
illepic / private-github-release-download.sh
Last active January 2, 2024 09:43
Download the latest release binary from a private GitHub repo. (i.e. a .tar.gz that you have manually uploaded in a GitHub release). Update OAUTH_TOKEN, OWNER, REPO, FILE_NAME with your custom values.
#!/usr/bin/env bash
# Authorize to GitHub to get the latest release tar.gz
# Requires: oauth token, https://help.github.com/articles/creating-an-access-token-for-command-line-use/
# Requires: jq package to parse json
# Your oauth token goes here, see link above
OAUTH_TOKEN="34k234lk234lk2j3lk4j2l3k4j2kj3lk"
# Repo owner (user id)
OWNER="your-user-name"
@andreibosco
andreibosco / creative-cloud-disable.md
Last active January 3, 2024 02:37
disable creative cloud startup on mac
@lancejpollard
lancejpollard / node-folder-structure-options.md
Created November 28, 2011 01:50
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@joshnuss
joshnuss / app.js
Last active March 4, 2024 00:01
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.