Skip to content

Instantly share code, notes, and snippets.

View squallstar's full-sized avatar
🍉

Nicholas Valbusa squallstar

🍉
View GitHub Profile
@squallstar
squallstar / Data Source schema.md
Created May 23, 2023 08:50
AI Generated docs from Schema

Data Source Schema

This JSON schema defines the structure of a Data Source component used in Fliplet apps. The component includes a name, list of columns, entries (data), and access rules.

Properties

name

  • Type: string
  • Required: Yes
  • Title: The name of the data source.
@squallstar
squallstar / Export.md
Last active April 21, 2023 12:48
Novels to JS - ChatGPT JS

Message From You:

summarize romeo and juliet in 10 words

Message From ChatGPT:

Young love, feuding families, tragedy, death.

Message From You:

now 5

Message From ChatGPT:

@squallstar
squallstar / viewer.html
Created January 26, 2017 21:20
Pinch gestures for pdf.js
<script type="text/javascript">
var gesturesSetUp = false;
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1;
document.addEventListener('textlayerrendered', function (e) {
if (gesturesSetUp || e.detail.pageNumber !== PDFViewerApplication.page) {
return;
}
@squallstar
squallstar / README.md
Created October 4, 2019 11:19
GitHub issues to CSV
  1. Replace username, password and repo name at the end of file
  2. Run python github_issues_to_csv.py
@squallstar
squallstar / time_ago.php
Last active January 15, 2020 14:09
Posted x time ago (PHP function)
<?php
function time_ago($date,$granularity=2) {
$difference = time() - $date;
$retval = '';
$periods = array('decade' => 315360000,
'year' => 31536000,
'month' => 2628000,
'week' => 604800,
'day' => 86400,
'hour' => 3600,
@squallstar
squallstar / .zshrc
Created March 21, 2019 11:01
My .zshrc
export ZSH="/Users/nicholas/.oh-my-zsh"
ZSH_THEME="powerlevel9k/powerlevel9k"
plugins=(
git
)
source $ZSH/oh-my-zsh.sh
@squallstar
squallstar / cache.php
Last active June 11, 2018 16:37
PHP Cache like Rails.cache.fetch
<?php
/**
* PHP Cache class inspired by Rails.cache.fetch
*
* @author Nicholas Valbusa - @squallstar
* @copyright Copyright (c) 2014, Nicholas Valbusa
* @license GNU/GPL (General Public License)
* @link https://gist.github.com/squallstar/9093354
*
*/
@squallstar
squallstar / 0_reuse_code.js
Created August 8, 2016 08:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@squallstar
squallstar / gist:7f08277c8525a4c43efa364dd2672e32
Created May 20, 2016 14:36
Find and sort unique matches in log file
cat file.log | grep 'edition_id=[0-9][0-9][0-9][0-9][0-9]' -o | sort | uniq -c | sort -nr
4670 edition_id=22579
3554 edition_id=22627
1911 edition_id=22586
1168 edition_id=22482
1128 edition_id=22651
1035 edition_id=21786
1014 edition_id=22462
896 edition_id=22618
@squallstar
squallstar / gist
Created May 12, 2016 15:49
Edit HTML
javascript:document.body.contentEditable%3D%27true%27%3B document.designMode%3D%27on%27%3B void 0