Skip to content

Instantly share code, notes, and snippets.

View enkr1's full-sized avatar
🎯
If you actually try your best, you can't lose.

ENKR | Jing Hui PANG | 彭竞辉 enkr1

🎯
If you actually try your best, you can't lose.
View GitHub Profile
@ivan
ivan / 2023_reading.md
Last active July 7, 2024 18:18
2023 reading list

[This page is best viewed with https://github.com/ludios/expand-everything, which will load all the comnents below.]

Wherein I try to prioritize reading for the limited amount of time I have this year, and to remind myself to read more than just comments on the Internet. Because of problems of time and shifting interests, I will consider this a success if I read a third of the list. I'll reflect on the reading and deviations from the plan in Jan 2024.

{+} = added after initial planning

@berndverst
berndverst / copilot example.md
Created June 29, 2021 16:46
Simple Copilot Example

Existing code:

import requests


def get_hacker_news_stories_by_search_term(search_term: str):
    """
    Get the stories from Hacker News mentioning the search term.
 """
@av
av / main.dart
Created January 13, 2020 18:44
Flutter: neu
import 'package:flutter/material.dart';
void main() => runApp(NeumorphicApp());
class NeumorphicApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Neumorphic App',
theme: ThemeData(
@alasomlira
alasomlira / index.html
Created December 10, 2019 02:11
SwiperJS & YouTube
<div class="wrap">
<div class="wrap-inner">
<div class="swiper-outter">
<div id="video-swiper" class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="video-container">
<div class="yt-player" data-id="MxBRpWcXeOA"></div>
@Zyndoras
Zyndoras / rotate.js
Last active April 29, 2024 11:41
Rotate base64 image (Javascript)
function rotate(srcBase64, degrees, callback) {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const image = new Image();
image.onload = function () {
canvas.width = degrees % 180 === 0 ? image.width : image.height;
canvas.height = degrees % 180 === 0 ? image.height : image.width;
ctx.translate(canvas.width / 2, canvas.height / 2);
@Lecarvalho
Lecarvalho / iconbutton_reddot_notification_widget.dart
Created October 5, 2019 11:43
Icon with a red dot to presume a notification
import 'package:flutter/material.dart';
class IconButtonRedDotNotificationWidget extends StatelessWidget {
final IconData icon;
final Function onTap;
IconButtonRedDotNotificationWidget(this.icon, {this.onTap});
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
@hariangr
hariangr / example.dart
Created June 5, 2019 13:31
Docked FloatingActionButton center with BottomNavigationBar
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: Scaffold(
@choyno
choyno / nginxsetup.txt
Last active March 23, 2024 15:21
RESTART NGINX AMAZON LINUX AMI
Try to run the following two commands:
sudo fuser -k 80/tcp
sudo fuser -k 443/tcp
NGINX BASIC COMMAND
sudo service nginx restart
sudo service nginx start
sudo service nginx stop
@wosephjeber
wosephjeber / instructions.md
Last active June 27, 2024 00:35
Ecto migration for renaming table with indexes and constraints

Renaming table in Ecto migration

I recently wanted to rename a model and its postgres table in a Phoenix app. Renaming the table was simple and documented, but the table also had constraints, sequences, and indexes that needed to be updated in order for the Ecto model to be able to rely on default naming conventions. I couldn't find any examples of what this would look like but was eventually able to figure it out. For anyone else in the same situation, hopefully this example helps.

In the example below, I'm renaming the Permission model to Membership. This model belongs to a User and an Account, so it has foreign key constraints that need to be renamed.

defmodule MyApp.Repo.Migrations.RenamePermissionsToMemberships do
  use Ecto.Migration
@bradtraversy
bradtraversy / docker_wordpress.md
Last active July 21, 2024 05:00
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes