Skip to content

Instantly share code, notes, and snippets.

View georgebyte's full-sized avatar

George Byte georgebyte

View GitHub Profile
@georgebyte
georgebyte / send_daily_wisdom_email.gs
Created October 4, 2019 07:22
Send daily email with a random quote from a Google Sheets document
function sendDailyWisdom() {
var FIRST_ROW = 2;
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
var rows = ss.getRange(FIRST_ROW, 1, ss.getLastRow(), 1).getValues();
var randomWisdomRow = Math.floor(Math.random() * (rows.length - FIRST_ROW + 1)) + FIRST_ROW;
var randomWisdom = ss.getRange(randomWisdomRow, 1).getValue();
var source = ss.getRange(randomWisdomRow, 2).getValue();
var htmlBody =
'<div style="width: 500px; font-family: Times New Roman; font-size: 18px;">' +
randomWisdom +
@georgebyte
georgebyte / example.ts
Created September 17, 2018 06:21
Observable store fetch data "side effect"
loadData() {
this.setState({
...this.state,
requestInProgress: true,
});
return this.http.get(url).pipe(
tap(data => {
this.setState({
...this.state,
data: data,
This file has been truncated, but you can view the full file.
{
"AD": {
"iso": "AD",
"iso3": "AND",
"numeric": 20,
"fips": "AN",
"reference": {
"geonames": 3041565,
"openstreetmap": 9407,
"wikipedia": "en:Andorra"
@georgebyte
georgebyte / requestAnimationFrame-throttling.js
Created March 6, 2017 06:37
Javascript: Throttling with requestAnimationFrame
// Polyfill for rAF
window.requestAnimFrame = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000 / 60);
};
})();
@georgebyte
georgebyte / .eslintrc
Last active November 18, 2015 12:41
.eslintrc - ESLint config
{
// http://eslint.org/docs/rules/
"env": {
"browser": true,
"es6": true,
},
"globals": {
"$": true,
"jQuery": true
@georgebyte
georgebyte / toggle-fullscreen.js
Last active August 30, 2019 09:30
Javascript: Toggle browser fullscreen mode
$('body').click(function(event) {
var el, rfs;
if ($('body').hasClass('fullscreen')) {
el = document;
rfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen;
$('body').removeClass('fullscreen');
} else {
el = document.documentElement;
rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen;
@georgebyte
georgebyte / flexible-media-query-mixin.scss
Last active March 6, 2017 06:38
CSS, Sass: Flexible media query mixin
//base font
$bf: 16;
@mixin bp($bp, $min-max: min-width) {
$em: $bp/$bf;
@media(#{$min-max}: #{$em}em) { @content; }
}
//including the mixin
.element {
@georgebyte
georgebyte / responsive-tables-in-pure-css.html
Last active August 30, 2019 09:35
HTML5, CSS: Responsive tables in pure CSS
<table>
<thead>
<tr>
<th>Payment</th>
<th>Issue Date</th>
<th>Amount</th>
<th>Period</th>
</tr>
</thead>
<tbody>
@georgebyte
georgebyte / css-properties-order.css
Last active March 6, 2017 06:39
CSS: CSS properties order
.selector {
/* Positioning */
position: absolute;
z-index: 10;
top: 0;
right: 0;
/* Display & Box Model */
display: inline-block;
overflow: hidden;
@georgebyte
georgebyte / node-express-create-project-readme.md
Last active March 6, 2017 06:39
Node, Express, Hogan, Compass: Create Node app with Express web aplication framework + Hogan and Compass

Create node.js app with Express web aplication framework + Hogan and Compass

Install express and nodemon.

sudo npm install -g express
sudo npm install -g nodemon

Create express project.