Skip to content

Instantly share code, notes, and snippets.

View quardz's full-sized avatar
💭
I may be slow to respond.

Quardz quardz

💭
I may be slow to respond.
  • Bangalore India
View GitHub Profile
@quardz
quardz / uuid-generator
Created September 16, 2016 11:47
JS function to create UUID number
function uuid-generator() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}
@quardz
quardz / gist:e3616451a23438b60759ce9ddc6328f6
Created December 7, 2016 13:17
Drupal 8, get the human readable name for worflow state, field formatter
if(!$items->isEmpty()) {
$state = $items->getString();
$wf_state = entity_load('workflow_state' , $state);
return $wf_state->label;
}
return FALSE;
@quardz
quardz / ProgramWorkflowTextWorkflowStateFormatter.php
Last active December 8, 2016 15:56
Drupal 8 workflow state human readable text
<?php
/**
* @file
* Contains \Drupal\program_workflow\Plugin\Field\FieldFormatter\ProgramWorkflowTextWorkflowStateFormatter.
*/
namespace Drupal\program_workflow\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FormatterBase;
// Check the stuff per operation for node
// This logic is for contect access stuff
function _xxxxx_workflow_entity_access_unpublished_nodes($entity, $account, $op = 'view') {
$permission = 'myeap ' . $op . ' unpublished nodes';
$has_view_permission = $account->hasPermission($permission);
$node_roles = content_access_per_node_setting($op, $entity);
$user_roles = $account->getRoles();
$intersect_roles = array_intersect($node_roles, $user_roles);
if(count($intersect_roles) && $has_view_permission) {
@quardz
quardz / ip_geoloc.api.inc.php
Created December 28, 2016 10:41
Drupal 7 views IP geoloc patch for line 304, this adds
<?php
//Added by @adal
if(isset($_GET['zipcode']) && trim($_GET['zipcode'])) {
$zipcode_latlong = _sss_custom_zipcode2geo_array(trim($_GET['zipcode']));
$zipcode_location = new stdClass();
$zipcode_location->longitude = $zipcode_latlong['long'];
$zipcode_location->latitude = $zipcode_latlong['lat'];
$zipcode_location->balloon_text = "Your search for this zipcode : " . $_GET['zipcode'];
$zipcode_location->open = '';
array_unshift($locations, $zipcode_location);
yaml = require('js-yaml');
fs = require('fs-extra');
_ = require('underscore');
var from_dir = "";
var to_dir = "";
runthrough(from_dir, to_dir);
@quardz
quardz / Bootstrap color css
Created May 4, 2017 10:36
Bootstrap 3.7 color css
a {
background: transparent;
}
mark {
background: #ff0;
color: #000;
}
@quardz
quardz / Book Extras
Created December 8, 2017 10:37
Drupal 8 module for book extra features
Hierarical select for book outline
All Book menu cached
Book Path (based on menu), views field
Book Views by parents
Better Book filter for views
Get Xth parent of a book page
Get Xth Child of a book page
Get immediate child(counts and items) of a book page
Get All childs(counts and items) of a book page
JSON API for quick stuff for book.
ALTER TABLE `menu_links` ADD `p10` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `p9` ;
ALTER TABLE `menu_links` ADD `p11` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `p10` ;
ALTER TABLE `menu_links` ADD `p12` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `p11` ;
ALTER TABLE `menu_links` ADD `p13` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `p12` ;
ALTER TABLE `menu_links` ADD `p14` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `p13` ;
ALTER TABLE `menu_links` ADD `p15` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `p14` ;
ALTER TABLE `menu_links` ADD `p16` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `p15` ;
ALTER TABLE `menu_links` ADD `p17` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `p16` ;
ALTER TABLE `menu_links` ADD `p18` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `p17` ;
ALTER TABLE `menu_links` ADD `p19` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `p18` ;
Features Details Cindicator Trakinvest Stox Enigma catalyst Coinfi Santiment cryptics iconomi Red pulse
Virtual Trading No Yes, in usage with half bn $ of virtual stocks Yes N/A No No No TBA TBA
Social Trading No Yes, in usage No No No Planned in future No TBA TBA
Education / Training No Yes, in usage with hireing program partner with top institues No No No No No TBA TBA
Certification No 1000+ certified, 100+ hired No No No No No TBA TBA
Copy trade No Yes, in usage No No No No No TBA TBA
Influencer / Top Trader No Yes, in usage top traders can earn tokens for allowing others to follow No No No No Planned TBA TBA
Invesment tracking No Yes, in usage No N/A Planned Planned Planned TBA TBA
Mobile Apps Yes Yes No No No No No TBA TBA
Signal / Predictions Yes, survey method Yes, Survey, AI, Copy signal from top performaers, Sentiments Yes, survey method TBA TBA TBA TBA TBA TBA