Skip to content

Instantly share code, notes, and snippets.

@pebriana
pebriana / submit.md
Created January 10, 2019 06:47 — forked from tanaikech/submit.md
Downloading Shared Files on Google Drive Using Curl

Downloading Shared Files on Google Drive Using Curl

When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.

File size < 40MB

CURL

filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&amp;id=${fileid}"
@pebriana
pebriana / .css
Created July 26, 2017 07:19 — forked from abemedia/.css
Pure CSS horizontal accordion slider
.donslide {
display: table;
width: 100%;
}
.donslide .item {
display: table-cell;
width: 1%;
transition: 0.6s ease-in-out all;
overflow: hidden;
position: relative;
@pebriana
pebriana / angular_data.html
Created April 27, 2016 04:22 — forked from MrSaints/angular_data.html
A simple AngularJS application to add / delete / list / sort data comprising of three fields (state code, price and tax). It was written to demonstrate to a friend, the simplicity and power of Angular to address programming challenges - in recruitment processes - quickly and effectively.
<!DOCTYPE html>
<html ng-app>
<head>
<title>Add / List Data (AngularJS)</title>
<style>
.list_data { margin-bottom: 2rem }
table, th, td { border: 1px solid #AAA }
th { cursor: pointer }
</style>
</head>
@pebriana
pebriana / wp-query-ref.php
Created April 12, 2016 03:53 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@pebriana
pebriana / uri.js
Created April 6, 2016 07:34 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@pebriana
pebriana / yii.php
Created April 6, 2016 07:26 — forked from fadib/yii.php
Yii 1 -> Yii 2
<?php
CHtml::cssFile() => Html::cssFile()
CHtml::scriptFile() => Html::jsFile()
CHtml::link() => Html::a()
CHtml::image() => Html::img()
CHtml::submitButton() => Html::submitButton()
// View
$this->renderPartial() => $this->render()
@pebriana
pebriana / main.php
Created February 10, 2016 09:05 — forked from cebe/main.php
REST routing with Yii 2 UrlManager
<?php
return array(
/* ... */
'components' => array(
/* ... */
'urlManager' => array(
'enablePrettyUrl' => true,
'rules' => require(__DIR__ . '/routes.php'),
),
// add this to your API controller in Yii
public function actionPreflight() {
$content_type = 'application/json';
$status = 200;
// set the status
$status_header = 'HTTP/1.1 ' . $status . ' ' . $this->_getStatusCodeMessage($status);
header($status_header);
-- Enable tablefunc
CREATE EXTENSION tablefunc;
-- Original Query Data
SELECT generate_series AS date,
b.desc AS TYPE,
(random() * 10000 + 1)::int AS val
FROM generate_series((now() - '100 days'::interval)::date, now()::date, '1 day'::interval),
(SELECT unnest(ARRAY['OSX', 'Windows', 'Linux']) AS DESC) b;
<?php
/**
* Calculate a precise time difference.
* @param string $start result of microtime()
* @param string $end result of microtime(); if NULL/FALSE/0/'' then it's now
* @return flat difference in seconds, calculated with minimum precision loss
*/
function microtime_diff($start, $end = null) {
if (!$end) $end = microtime();