Skip to content

Instantly share code, notes, and snippets.

View aindong's full-sized avatar
🎯
Focusing

Alleo Indong aindong

🎯
Focusing
View GitHub Profile
@aindong
aindong / export.swift
Last active January 8, 2023 20:23
Export Core Data into CSV in Swift 3
func createExportString() -> String {
var name : String?
var age : String?
var mobile : String?
var email : String?
var promo_crayola_bunding : Int16?
var promo_zip_it : Int16?
var promo_none : Int16?
var created : NSDate? = NSDate()
@aindong
aindong / DynamicSetterGetter.php
Created April 16, 2015 15:47
Dynamic setter/getter using __call magic method of php
<?php
class Person
{
protected $firstName;
protected $lastName;
/**
* Magic method call for setter and getter
*
* @param $methodName
@aindong
aindong / routes.ts
Created March 21, 2022 05:56
Dynamic Routing on Express JS
import express, { Response, Request } from 'express';
import fs from 'fs';
import { IRouterSettings } from './interfaces/IRouterSettings';
import Logger from './utils/logger';
const router = express.Router();
// loop through all the routes
const controllersPath = `${__dirname}/controllers`;
const controllers = fs.readdirSync(controllersPath);
@aindong
aindong / timedmint.sol
Created March 11, 2022 16:21
Hashlips simple nft contract with added start date of minting
// SPDX-License-Identifier: MIT
// Amended by HashLips
/**
!Disclaimer!
These contracts have been used to create tutorials,
and was created for the purpose to teach people
how to create smart contracts on the blockchain.
please review this code on your own before using any of
the following code for production.
@aindong
aindong / prisma.ts
Created March 10, 2022 08:08
Importing Prisma Best Practice on Nodejs + Express
import { PrismaClient } from '@prisma/client';
declare global {
// allow global `var` declarations
// eslint-disable-next-line no-var
var prisma: PrismaClient | undefined;
}
export const prisma =
global.prisma ||
@aindong
aindong / clamp_movement.gd
Created February 6, 2022 02:56
Limit the movement of sprite to screen only (CLAMP)
extends Area2D
export var speed = 400.0
var screen_size = Vector2.ZERO
# Called when the node enters the scene tree for the first time.
func _ready():
screen_size = get_viewport_rect().size
print(screen_size)
@aindong
aindong / move_sprite.gd
Created February 6, 2022 02:54
Move a sprite base on input
func _process(delta):
var direction = Vector2.ZERO
if Input.is_action_pressed("move_right"):
direction.x += 1
if Input.is_action_pressed("move_left"):
direction.x -= 1
if Input.is_action_pressed("move_down"):
direction.y += 1
if Input.is_action_pressed("move_up"):
direction.y -= 1
@aindong
aindong / get_screen_viewport.gd
Created February 6, 2022 02:53
Get 2d screen viewport in godot
var screen_size = Vector2.ZERO
# Called when the node enters the scene tree for the first time.
func _ready():
screen_size = get_viewport_rect().size
print(screen_size)
@aindong
aindong / laravel-permission.sh
Created October 10, 2017 17:10
normalize laravel permission for security and fixing logging issues of permission denied
#!/bin/bash
## create user group
sudo groupadd laravel
## add current user to group
sudo usermod -a -G www-data $USER
## add web server to group
sudo usermod -a -G www-data laravel
@aindong
aindong / main.dart
Created July 16, 2019 09:06
MiCard Flutter Practice
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(