Skip to content

Instantly share code, notes, and snippets.

View mbahar's full-sized avatar

Murat Bahar mbahar

  • Los Angeles, CA
View GitHub Profile
@mbahar
mbahar / product-description-builder.js
Last active February 17, 2021 20:29
Product desciption builder
// type your code here
/*
sample condition array:
['minor',['rubs','stains'],'lining']
['minor',['rubs'],'lining']
['minor',['rubs','stains','dirt'],'lining']
*/
@mbahar
mbahar / list.page.ts
Created July 11, 2018 23:03
Ionic 4 with AWS Amplify
import { Component, OnInit, Input } from '@angular/core';
import { ModalController, Events } from '@ionic/angular';
import { AmplifyService } from 'aws-amplify-angular'
import { ListItemModal } from './list.item.modal';
import { ToDoItem, ToDoList } from '../../classes/item.class';
@Component({
selector: 'app-list-page',
templateUrl: 'list.page.html'
})
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
module.exports = function (grunt) {
'use strict';
var exec = require('child_process').execSync,
glob = require('glob'),
@mbahar
mbahar / Breadcrumbs.php
Last active January 17, 2019 03:54
Fix for Magento 2 breadcrumbs inconsistency : Magento\Catalog\Block\Breadcrumbs
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/**
* Catalog breadcrumbs
@mbahar
mbahar / functions.php
Created September 16, 2013 21:25
database update
function setUserSchoolRole ( $user_id, $school_id, ) {
global $bp, $wpdb;
if ( $user_id && $school_id ) {
$sql = $wpdb->prepare( "SELECT role_id FROM tl_user_role WHERE user_id = %d AND school_id= %d ", $user_id, $school_id );
return $wpdb->query( $sql );
}
return false;
@mbahar
mbahar / evaluation.js
Created September 14, 2013 07:27
sample
// Query the database.
console.log(deneme);
db.executeSQL('SELECT * FROM tl_evaluation WHERE evaluation_id= ' +evaluation_id,queryParameters,sqlEndingClause,
function (rows) {
// get avaluation cycle info
db.executeSQL('SELECT * FROM tl_evaluation_cycle WHERE cycle_id=' +rows[0].evaluation_cycle_id ,queryParameters,sqlEndingClause,
function (cycle) {
rows[0].evaluation_cycle_name = cycle[0].cycle_desc;
@mbahar
mbahar / evaluation.js
Created September 14, 2013 06:46
cascaded functions
if(utilities.validateFields(queryParameters, request) ) {
// Query the database.
console.log(deneme);
db.executeSQL('SELECT * FROM tl_evaluation WHERE evaluation_id= ' +evaluation_id,queryParameters,sqlEndingClause,
function (rows) {
db.executeSQL('SELECT field_id, field_data_value AS value, field_option_id FROM tl_field_data WHERE entity_id = 1 AND entity_key_value= ' +evaluation_id ,queryParameters,sqlEndingClause,
function (field_data) {
rows[0].field_data = field_data;