git checkout master # you can avoid this line if you are in master...
git subtree split --prefix dist -b gh-pages # create a local gh-pages branch containing the splitted output folder
git push -f origin gh-pages:gh-pages # force the push of the gh-pages branch to the remote gh-pages branch at origin
git branch -D gh-pages # delete the local gh-pages because you will need it: ref
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git for-each-ref --format='%(refname:lstrip=3)' --sort=-creatordate --count 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create new subtree from latest commit for dist/ | |
commit=$(git subtree split --prefix=dist/ -b gh-pages) | |
# force push this commit to remote | |
git push mubaidr.github.io $commit:master --force | |
# git subtree push --prefix=dist/ mubaidr.github.io master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- add timestamps (created_at, updated_at) | |
-- add trigger for timestamp updated_at | |
CREATE OR REPLACE FUNCTION add_custom_timestamps() RETURNS void AS $$ | |
DECLARE | |
row_data RECORD; | |
-- row_data information_schema.tables%ROWTYPE; | |
BEGIN | |
FOR row_data IN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ******************************************************************************************* | |
* THE UPDATED VERSION IS AVAILABLE AT | |
* https://github.com/LeCoupa/awesome-cheatsheets | |
* ******************************************************************************************* */ | |
// 0. Synopsis. | |
// http://nodejs.org/api/synopsis.html | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSvgAsImage(svgElem, viewBox) { | |
// TODO: add x,y to w,h | |
var canvas = document.createElement('canvas') | |
canvas.width = viewBox[2] | |
canvas.height = viewBox[3] | |
var ctx = canvas.getContext('2d') | |
ctx.fillStyle = '#fff' | |
ctx.fillRect(0, 0, canvas.width, canvas.height) | |
var options = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file was initially generated by Windows Terminal Preview 1.1.1671.0 | |
// It should still be usable in newer versions, but newer versions might have additional | |
// settings, help text, or changes that you will not see unless you clear this file | |
// and let us generate a new one for you. | |
// To view the default settings, hold "alt" while clicking on the "Settings" button. | |
// For documentation on these settings, see: https://aka.ms/terminal-documentation | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var trimCanvas = (function() { | |
function rowBlank(imageData, width, y) { | |
for (var x = 0; x < width; ++x) { | |
if (imageData.data[y * width * 4 + x * 4 + 3] !== 0) return false; | |
} | |
return true; | |
} | |
function columnBlank(imageData, width, x, top, bottom) { | |
for (var y = top; y < bottom; ++y) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Polygon } from './types/ShapeType' | |
import { perpendicularDistance } from './utilities' | |
// distance between two points | |
function distance(p1: Point, p2: Point): number { | |
return Math.sqrt((p2.x - p1.x) ** 2 + (p2.y - p1.y) ** 2) | |
} | |
// perpendicular distance of a point from a line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION get_Exact_Date_diff(@date SMALLDATETIME,@date2 SMALLDATETIME) | |
returns VARCHAR(50) | |
AS | |
BEGIN | |
DECLARE @date3 SMALLDATETIME | |
DECLARE @month INT,@year INT,@day INT |