Skip to content

Instantly share code, notes, and snippets.

View asika32764's full-sized avatar

Simon Asika asika32764

View GitHub Profile
@asika32764
asika32764 / spinner.rb
Created June 24, 2016 01:01 — forked from ellemenno/spinner.rb
ascii spinner
#!/usr/bin/env ruby
# encoding: UTF-8
@dot_cycle = ['⣾','⣽','⣻','⢿','⡿','⣟','⣯','⣷']
#braille random: 0x2800 - 0x28ff
@z_arrow = ['←','↖','↑','↗','→','↘','↓','↙']
@z_b = ['b','ᓂ','q','ᓄ']
@z_d = ['d','ᓇ','p','ᓀ']
@asika32764
asika32764 / mini_google_authenticator.php
Created April 22, 2022 10:30 — forked from Cojad/mini_google_authenticator.php
Very small implementation of Google's OTP Authenticator
<?php
// copied from python code at https://stackoverflow.com/a/23221582/3103058
function base32_decode($key) {
// https://www.php.net/manual/en/function.base-convert.php#122221
$key = strtoupper($key);
list($t, $b, $r) = array("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", "", "");
foreach(str_split($key) as $c)
$b = $b . sprintf("%05b", strpos($t, $c));
foreach(str_split($b, 8) as $c)
$r = $r . chr(bindec($c));
@asika32764
asika32764 / github-oauth2-client.php
Last active January 28, 2024 19:44
Simple PHP example of using Github's OAuth 2 API. (Please see comments for PHP 8.1 later and latest API version.)
<?php
define('OAUTH2_CLIENT_ID', '');
define('OAUTH2_CLIENT_SECRET', '');
$authorizeURL = 'https://github.com/login/oauth/authorize';
$tokenURL = 'https://github.com/login/oauth/access_token';
$apiURLBase = 'https://api.github.com/';
session_start();
@asika32764
asika32764 / dbExport.java
Created December 3, 2023 10:32 — forked from frontrangerider2004/dbExport.java
Export all SQLite database files from your Android Application's private data directory to the SD Card
public static void exportAllDatabases(final Context context) {
Log.d(LOG_TAG, "exportAllDatabases: ");
File sd = Environment.getExternalStorageDirectory();
if (sd.canWrite()) {
final File[] databases = new File(context.getFilesDir().getParentFile().getPath() + "/databases").listFiles();
for (File databaseFile: databases) {
final String backupFilename = databaseFile.getName() + "-" + Build.SERIAL +
"-" + System.currentTimeMillis() + ".db";
File backupFile = new File(sd, backupFilename);
FileChannel inputChannel = null;
@asika32764
asika32764 / arc-places.json
Created June 13, 2023 20:25 — forked from jthomassie/arc-places.json
d3 globe arcs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asika32764
asika32764 / preg_replace_test.php
Created June 29, 2022 19:00 — forked from eduardomello/preg_replace_test.php
use of PHP preg_replace() to add basepath to src and href
<?php
/*
* Script that shows how to insert a basepath on HTML tags
* It looks for link, script and img tags that do not contain the
* determined basepath or a external URL
*/
// BasePath to insert in string when necessarry
$basePath = "/project/site/";
$escapedBasePath = str_replace("/", "\/", $basePath);
<?php
/**
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Data;
use Psr\Cache\CacheInterface;
@asika32764
asika32764 / php-class-to-read-psd-files
Created March 11, 2022 16:17 — forked from devluis/php-class-to-read-psd-files
PHP class to read PSD files
<?
/* This file is released under the GPL, any version you like
*
* PHP PSD reader class, v1.3
*
* By Tim de Koning
*
* Kingsquare Information Services, 22 jan 2007
*
* example use:
@asika32764
asika32764 / Install Composer using MAMP's PHP.md
Created February 8, 2018 12:39 — forked from irazasyed/Install Composer using MAMP's PHP.md
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

joomla
```
index
|
v
routing
|
v
controller <---- models <-- table & form
| |