Skip to content

Instantly share code, notes, and snippets.

View yogasukma's full-sized avatar

Yoga Sukma yogasukma

View GitHub Profile
@yogasukma
yogasukma / index.php
Last active January 30, 2024 00:27
generate app pass for login user
<?php
if (!is_user_logged_in() ) {
echo "<a href='" . wp_login_url('/') . "'>login</a>";
} else {
$user_id = get_current_user_id(); // get user id
$app_name = 'app_' . date("y-m-d-H-i-s"); // create random app name
$app_pass = WP_Application_Passwords::create_new_application_password( $user_id, array( 'name' => $app_name ) ); // generate pass
$chunks = str_split($app_pass[0], 4); // Split string into chunks of 4 characters
$result = implode(" ", $chunks); // Join chunks with space between them
set noswapfile
set nocompatible
set nowrap
set expandtab
set laststatus=2
set tabstop=4
set shiftwidth=4
set splitright
set splitbelow
filetype off
@yogasukma
yogasukma / parse-csv.php
Created March 16, 2017 12:05
Parsing CSV and store it using active record
<?php
// define the path
$filePath = "data.csv";
// check if we can read the file
if (($handle = fopen($filePath, "r")) !== FALSE) {
// do looping until no more line on csv
while (($data = fgetcsv($handle)) !== FALSE) {
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async='async'></script>
<script>
var OneSignal = window.OneSignal || [];
OneSignal.push(["init", {
appId: "xxxx",
subdomainName: 'zzzzz',
autoRegister: false, /* Set to true to automatically prompt visitors */
httpPermissionRequest: {
enable: true
},
@yogasukma
yogasukma / gist:25f1ff840d12314d74b0a38cd114a7d6
Created December 5, 2016 23:31
ipn data received for recurring payment
mc_gross=289.00
&outstanding_balance=0.00
&period_type=+Regular
&next_payment_date=02%3A00%3A00+Dec+05%2C+2016+PST
&protection_eligibility=Eligible
&payment_cycle=Daily
&address_status=confirmed
&tax=0.00
&payer_id=QGEY9E3FZ92JY
&address_street=1+Main+St
▶ grep -r ")->" .
./App/Comment.php: ( new UserActivity() )->insert( $activity );
./App/Core.php: ( new CustomColumnForPost() )->run();
./App/Core.php: Loader::load( $this->rootPath( '.env' ) )->parse()->putenv();
./App/Core.php: ( new User() )->downloadCsv();
./App/Facebook.php: ( new User() )->create( $this->getMyProfile() );
./App/Facebook.php: $response = $this->fb->getClient()->sendRequest( $request );
./App/Facebook.php: $access_token = $this->doRequest( 'GET', $page_id . '?fields=access_token' )->getGraphNode()['access_token'];
./App/Facebook.php: $fbPages = $this->doRequest( 'get', '/' . $id )->getGraphNode();
<option
<?php if ( $global['button_style'] == 'icon-text' ) {
echo ' selected="selected"';
}?> value="icon-text"><?php _e( 'Icon + text', 'jetpack' ); ?></option>
<option
<?php if ( $global['button_style'] == 'icon' ) {
echo ' selected="selected"';
} ?> value="icon"><?php _e( 'Icon only', 'jetpack' ); ?></option>
$.ajaxPrefilter( function (options) {
if (options.crossDomain && jQuery.support.cors) {
var http = (window.location.protocol === 'http:' ? 'http:' : 'https:');
options.url = http + '//cors-anywhere.herokuapp.com/' + options.url;
//options.url = "http://cors.corsproxy.io/url=" + options.url;
}
});
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
"let Vundle manage Vundle, required
@yogasukma
yogasukma / country.html
Last active September 8, 2017 18:10
List Of country
<option>Select Your Country</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Anguilla">Anguilla</option>
<option value="Antarctica">Antarctica</option>
<option value="Antigua and Barbuda">Antigua and Barbuda</option>