Skip to content

Instantly share code, notes, and snippets.

View abedputra's full-sized avatar
😄
LoveToCode

Abed Putra abedputra

😄
LoveToCode
View GitHub Profile
@festum
festum / go-code-convention.md
Last active June 23, 2023 15:36
Golang Guideline

Project Structure

The following content shows a general structure of a web app, it can be changed based on the different conventions of web frameworks.

- templates (views) # Template files
@dideler
dideler / bot.rb
Last active May 12, 2024 01:25
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@cse031sust02
cse031sust02 / push.php
Created January 24, 2018 11:23
Send push notification using Firebase
<?php
use GuzzleHttp;
$access_token = 'FIREBASE CLOUD MESSAGING SERVER KEY';
$reg_id = 'DEVICE REGISTRATION ID';
$message = [
'notification' => [
@devinsays
devinsays / example-ajax-enqueue.php
Last active October 4, 2023 13:09
Simple WordPress Ajax Example
<?php
function example_ajax_enqueue() {
// Enqueue javascript on the frontend.
wp_enqueue_script(
'example-ajax-script',
get_template_directory_uri() . '/js/simple-ajax-example.js',
array( 'jquery' )
);
@john1jan
john1jan / PrefKeys.java
Last active February 16, 2022 23:45
Utils class for storing and retrieving data from SharedPreference in Android
/**
* Created by john.francis on 24/05/16.
*/
public class PrefKeys {
public static final String USER_INCOME = "USER_INCOME";
public static final String USER_MARITAL_STATUS = "USER_MARITAL_STATUS";
public static final String USER_SALARY_FLOAT= "USER_SALARY_FLOAT";
public static final String USER_SALARY_LONG= "USER_SALARY_LONG";
public static final String USER_AGE= "USER_AGE";
}
@nicklasos
nicklasos / download.php
Last active January 31, 2024 09:13
Curl PHP multiple files downloading
<?php
function multiple_download(array $urls, $save_path = '/tmp')
{
$multi_handle = curl_multi_init();
$file_pointers = [];
$curl_handles = [];
// Add curl multi handles, one per file we don't already have
foreach ($urls as $key => $url) {
@anchetaWern
anchetaWern / php-webscraping.md
Created August 4, 2013 13:18
web scraping in php

Have you ever wanted to get a specific data from another website but there's no API available for it? That's where Web Scraping comes in, if the data is not made available by the website we can just scrape it from the website itself.

But before we dive in let us first define what web scraping is. According to Wikipedia:

{% blockquote %} Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. Usually, such software programs simulate human exploration of the World Wide Web by either implementing low-level Hypertext Transfer Protocol (HTTP), or embedding a fully-fledged web browser, such as Internet Explorer or Mozilla Firefox. {% endblockquote %}

@pavellauko
pavellauko / timezones_array.php
Created July 10, 2012 10:35
Time zones as arrays (PHP)
<?php
$timezones = array(
'America/Adak' => '(GMT-10:00) America/Adak (Hawaii-Aleutian Standard Time)',
'America/Atka' => '(GMT-10:00) America/Atka (Hawaii-Aleutian Standard Time)',
'America/Anchorage' => '(GMT-9:00) America/Anchorage (Alaska Standard Time)',
'America/Juneau' => '(GMT-9:00) America/Juneau (Alaska Standard Time)',
'America/Nome' => '(GMT-9:00) America/Nome (Alaska Standard Time)',
'America/Yakutat' => '(GMT-9:00) America/Yakutat (Alaska Standard Time)',
'America/Dawson' => '(GMT-8:00) America/Dawson (Pacific Standard Time)',
@keithmorris
keithmorris / .htaccess
Created June 30, 2012 12:09
CodeIgniter .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]