Skip to content

Instantly share code, notes, and snippets.

View pgorod's full-sized avatar

pgorod

View GitHub Profile
@pgorod
pgorod / backup_github_issues.sh
Last active October 5, 2024 11:09 — forked from bojanpopic/backup_github_issues.sh
A (dirty) bash script that will backup issues from the GitHub repo using API. It takes pagination into consideration. Originally created by @boombatower, improved by @bojanpopic, them improved by me to handle number of pages automatically.
#!/bin/bash
# based on the script by Bojan Popic https://gist.github.com/bojanpopic/2c3025d2952844de1dd0
# Gets all issues form a repo. Since Pull Requests are also Issues in Github internally, these are also included.
repo="organization/repoName" # put the name of the repo here. Usually it is like this: organization/repo-na$
username="myuser" # your github username
password="mypassword" # your github password
# this script can be used on public repos with any user's credentials, you don't have to own the repo!
@pgorod
pgorod / gist:c838f258fadf9528b61183e763e978a8
Last active October 8, 2017 18:11 — forked from jmertic/gist:3684162
HOWTO: Adding your own ListView action items - Part 2
<?php
class CustomAccountsController extends SugarController
{
public function action_displaypassedids() {
if ( !empty($_REQUEST['uid']) ) {
$recordIds = explode(',',$_REQUEST['uid']);
foreach ( $recordIds as $recordId ) {
$bean = SugarModule::get($_REQUEST['module'])->loadBean();
$bean->retrieve($recordId);
@pgorod
pgorod / gist:5de7c6f8d37413654b16e06668d7e1b1
Last active February 12, 2024 19:36 — forked from jmertic/gist:3684156
HOWTO: Adding your own ListView action items - Part 1
<?php
require_once('include/MVC/View/views/view.list.php');
class CustomAccountsViewList extends ViewList
{
/**
* @see ViewList::preDisplay()
*/
public function preDisplay()
@pgorod
pgorod / Fix "selected" in Listviews, SuiteR
Created October 10, 2017 14:59
Fix "selected" in Listviews, SuiteR
jssource/src_files/include/javascript/sugar_3.js
Line 2432
sugarListView.prototype.toggleSelected = function () {
var numSelected = sugarListView.get_num_selected();
var selectedRecords = document.getElementById("selectedRecordsTop");
var selectActions = document.getElementById("selectActions");
var selectActionsDisabled = document.getElementById("selectActionsDisabled");
Dumps backtrace into log, with chronological order
Call with
$GLOBALS['log']->debug(generateCallTrace());
----------------
function generateCallTrace()
{
@pgorod
pgorod / gist:c535ba65ee81e1e9893d90097a899236
Created March 28, 2018 08:49
Populate a dropdown from the database (SuiteCRM)
https://web.archive.org/web/20140116145925/http://www.eggsurplus.com/home/content/populate-a-dropdown-from-the-database/
@pgorod
pgorod / Undo a commit and redo
Created April 2, 2018 17:00 — forked from tkersey/Undo a commit and redo
Git: undo a commit and redo
http://stackoverflow.com/questions/927358/git-undo-last-commit
Undo a commit and redo
$ git commit ...
$ git reset --soft HEAD^ (1)
$ edit (2)
$ git commit -a -c ORIG_HEAD (3)
This is most often done when you remembered what you just committed is incomplete, or you misspelled your commit message, or both. Leaves working tree as it was before "reset".
@pgorod
pgorod / Import_script.php
Last active July 22, 2022 08:33
Sample Import_script for SuiteCRM, CSV to beans and relationships, and security groups
<?php
//xdebug_break();
if (!defined('sugarEntry') || !sugarEntry) die ('Not a Valid Entry Point!');
$date= new DateTime();
//chdir('/opt/bitnami/apps/suitecrm/htdocs/');
echo 'School Importer started at ';
echo $date->format('r').'<br>';
echo '-------------------------------------------------------------------------------------------------------------------------------------<br>';
@pgorod
pgorod / repair.php
Created December 12, 2018 18:04 — forked from chicks/repair.php
Quick Repair and Rebuild Sugar from the Command line - adapted from Jeff Bickhart's version.
#! /usr/bin/env php
<?php
# Stuff we have to do
if(!defined('sugarEntry'))define('sugarEntry', true);
function usage() {
global $argv;
return "\n" . $argv[0] . " <path to sugar>\n";
}
<?php
namespace Pokus;
class Exception extends \Exception
{
}
function tttt($string)
{
try {