Skip to content

Instantly share code, notes, and snippets.

View boghy933's full-sized avatar
💭
Hello :)

Alexandru Bogdan Bostan boghy933

💭
Hello :)
View GitHub Profile
@primaryobjects
primaryobjects / Code.gs
Last active January 16, 2023 16:48
Export a Google Drive spreadsheet to PDF in Google Drive in the same folder.
// Simple function to add a menu option to the spreadsheet "Export", for saving a PDF of the spreadsheet directly to Google Drive.
// The exported file will be named: SheetName and saved in the same folder as the spreadsheet.
// To change the filename, just set pdfName inside generatePdf() to something else.
// Running this, sends the currently open sheet, as a PDF attachment
function onOpen() {
var submenu = [{name:"Save PDF", functionName:"generatePdf"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu('Export', submenu);
}
@lalyos
lalyos / download-github-release-assets.md
Last active September 13, 2017 10:38
Download binary asset from private github repo

latest release assets

export GITHUB_REPO=hortonworks/hdc-cli

curl -s \
 -H "Authorization: token $GITHUB_TOKEN" \
   https://api.github.com/repos/$GITHUB_REPO/releases/latest \
 | jq ".assets[]|[.name,.url][]" -r \
@maxim
maxim / gh-dl-release
Last active August 29, 2024 07:18
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@christopheranderton
christopheranderton / github-brand-colors-aug-2015.css
Last active April 28, 2020 19:30
Official Github Brand Colors (August 20, 2015) from the GitHub internal CSS framework (Primer) version 2.3.3 at: http://primercss.io/colors/ [Note: Photoshop users. You can download the raw file (.css) and import the swatches just like a .aco file (more recent versions of Photoshop).
/* # OFFICIAL GITHUB BRAND COLORS
--------------------------------------------------------------------
Official Github Brand Colors (August 20, 2015) from the
GitHub internal CSS framework (Primer) version 2.3.3
Source URI: http://primercss.io/colors/
1.a = Github Branding Color Swatches
-------------------------------------------------------------------- */
.swatch-github-blue {
background-color:#4078c0;
@chuckmo
chuckmo / diable_wc_shipping_rates_cache.php
Last active September 7, 2023 22:17
Disable WooCommerce's Shipping Rates Cache
// updated per harisrozak:
add_filter('woocommerce_checkout_update_order_review', 'clear_wc_shipping_rates_cache');
function clear_wc_shipping_rates_cache(){
$packages = WC()->cart->get_shipping_packages();
foreach ($packages as $key => $value) {
$shipping_session = "shipping_for_package_$key";
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active July 26, 2024 20:21
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@Integralist
Integralist / GitHub curl.sh
Last active August 15, 2024 15:21 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@marcogrueter
marcogrueter / progress-cmd-line.php
Created October 18, 2013 07:38
Percentage progress bar on cmd line in php
$data = getData();
$step = 100 / count($data);
$percent = 0;
echo 'Doing stuff with data: '; //padding at the end for the number
foreach($data as $row)
{
// do stuff
@thefuxia
thefuxia / t5-parent-terms-body-class.php
Last active July 8, 2020 15:30
Parent Terms in body_class
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Parent Terms in body_class
* Description: Adds all parent terms of a term archive to <code>body_class()</code>.
* Version: 2012.0.14
* Author: Fuxia Scholz
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
@jcanfield
jcanfield / wp-modifydb.php
Created March 29, 2012 17:06
Serialized PHP Search and Replace
<?php
/**
*
* Safe Search and Replace on Database with Serialized Data v2.0.1
*
* This script is to solve the problem of doing database search and replace when
* developers have only gone and used the non-relational concept of serializing
* PHP arrays into single database columns. It will search for all matching
* data on the database and change it, even if it's within a serialized PHP
* array.