Skip to content

Instantly share code, notes, and snippets.

View angelo510's full-sized avatar
🏠
Working from home

Angelo ^_^ angelo510

🏠
Working from home
  • Independent Freelancer
View GitHub Profile
@angelo510
angelo510 / magento_customer.php
Created January 19, 2017 16:55
Magento Customer
<?php
$countryCollection = Mage::getModel('directory/country_api')->items();
function getCountryId($country_name){
global $countryCollection;
$country_name = trim($country_name);
foreach ($countryCollection as $country) {
if (strtolower($country['name']) == strtolower($country_name)){
return $country['country_id'];
}elseif (strtolower($country['country_id']) == strtolower($country_name)) {
return $country['country_id'];
@angelo510
angelo510 / ResizeImage.php
Created January 19, 2017 17:18
Magento Resize Image
<?php
namespace EShop\ImageResizer\Controller\Adminhtml\Cache;
use Magento\Backend\App\Action\Context;
use Magento\Backend\Controller\Adminhtml\Cache as MagentoAdminCache;
use Magento\Framework\App\Cache\Frontend\Pool;
use Magento\Framework\App\Cache\StateInterface;
use Magento\Framework\App\Cache\TypeListInterface;
use Magento\Framework\Exception\LocalizedException;
@angelo510
angelo510 / salesforce_snippet1
Created January 23, 2017 18:07
salesforce_snippet1
<?php
namespace Xsolve\SalesforceClient\Client;
use GuzzleHttp\Psr7\Request;
use Http\Client\Exception\HttpException;
use Http\Client\HttpClient;
use Psr\Http\Message\ResponseInterface;
use Xsolve\SalesforceClient\Enum\ContentType;
use Xsolve\SalesforceClient\Generator\TokenGeneratorInterface;
use Xsolve\SalesforceClient\Request\RequestInterface;
use Xsolve\SalesforceClient\Security\Token\TokenInterface;
@angelo510
angelo510 / salesforce_snippet2
Created January 23, 2017 18:08
salesforce_snippet2_model
<?php
namespace Xsolve\SalesforceClient\Model;
use JMS\Serializer\Annotation as JMS;
use Xsolve\SalesforceClient\Enum\AbstractSObjectType;
use Xsolve\SalesforceClient\Enum\SObjectType;
class Account extends AbstractSObject
{
/**
* @var bool|null
* @JMS\Type("boolean")
@angelo510
angelo510 / Client.html
Created January 24, 2017 15:14
AngularJS + Guacamole
<guac-viewport>
<!-- Client view -->
<div class="client-view">
<div class="client-view-content">
<!-- Central portion of view -->
<div class="client-body" guac-touch-drag="clientDrag" guac-touch-pinch="clientPinch">
<!-- Client -->
@angelo510
angelo510 / clientController.js
Created January 24, 2017 15:20
AngularJS Controller file which controls Guacamole
/**
* The controller for the page used to connect to a connection or balancing group.
*/
angular.module('client').controller('clientController', ['$scope', '$routeParams', '$injector',
function clientController($scope, $routeParams, $injector) {
// Required types
var ManagedClient = $injector.get('ManagedClient');
var ManagedClientState = $injector.get('ManagedClientState');
var ManagedFilesystem = $injector.get('ManagedFilesystem');
@angelo510
angelo510 / actions.js
Last active August 28, 2017 18:57
React+Redux+Saga Code Example
import {
SET_CHANNEL_FILTER,
SET_CHANNEL_TYPE,
SET_CONNECTIONS_LIST,
TOGGLE_ADD_CONNECTION_DIALOG,
FETCH_SOCIAL_URL,
CONNECTION_CALLBACK,
SET_SOCIAL_URLS,
REMOVE_CONNECTION,
SET_SUB_CALLBACK,
@angelo510
angelo510 / test.rb
Last active October 11, 2017 20:39
inputProducts = gets
total = 0
products = {
"A" => { "1" => 2.00, "4" => 7.00 },
"B" => { "1" => 12.00 },
"C" => { "1" => 1.25, "6" => 6.00 },
"D" => { "1" => 0.15 }
}
inputArray = inputProducts.split('') # input products
counts = Hash.new # number of item
@angelo510
angelo510 / base-field.component.ts
Created October 14, 2019 16:24
BaseFieldComponent with ControlValueAccessor for global field definition
import { EventEmitter, Input, Output } from "@angular/core";
import { ControlValueAccessor } from "@angular/forms";
import { parseBooleanAttribute } from "src/utils";
export abstract class BaseFieldComponent<T> implements ControlValueAccessor {
@Input() public fieldId?: string;
@Input() public label?: string;
@Input() public description?: string;
@Input() public value: T | null = null;
@angelo510
angelo510 / dropdown.component.ts
Created October 14, 2019 16:26
DropdownComponent extended from BaseFieldComponent
import {
Component,
ContentChildren,
EventEmitter,
forwardRef,
Input,
OnDestroy,
Output,
QueryList,
} from "@angular/core";