Skip to content

Instantly share code, notes, and snippets.

View lukluk's full-sized avatar
🍔
I may be slow to respond.

Lukluk lukluk

🍔
I may be slow to respond.
View GitHub Profile
@lukluk
lukluk / Magento Add Attribute Option
Created January 22, 2014 02:50
Magento Add Attribute Option
public function attributeValueExists($arg_attribute, $arg_value)
{
$attribute_model = Mage::getModel('eav/entity_attribute');
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
$attribute = $attribute_model->load($attribute_code);
$attribute_table = $attribute_options_model->setAttribute($attribute);
$options = $attribute_options_model->getAllOptions(false);
@lukluk
lukluk / Update Attribute Value
Created January 22, 2014 02:51
Update Attribute Value
$productCollection = Mage::getModel('catalog/product')->getCollection();
foreach($productCollection as $_product)
{
echo "\n".'updating '.$_product->getSku()."...\n";
$product = Mage::getModel('catalog/product')->load($_product->getEntityId());
$product->setData('add_ten_pence', 1)->getResource()->saveAttribute($product, 'add_ten_pence');
}
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
*
*/
var base64 = exports;
base64.encode = function (unencoded) {
var S = require('string');
var fs = require('fs');
var filendir = require('filendir')
module.exports = function(grunt) {
var coreWEBPath = "../../CoreWEB/",
wwwPath = "Hertz/www",
androidPhoneAssets = "Hertz/www/androidphone",
contentSourceRoot = "https://172.25.23.8"; // prk-agavecell cell 3 machine
var S = require('string');
var fs = require('fs');
var filendir = require('filendir')
module.exports = function(grunt) {
var coreWEBPath = "../../CoreWEB/",
wwwPath = "Hertz/www",
androidPhoneAssets = "Hertz/www/androidphone",
contentSourceRoot = "https://edyhertz.ngrok.com"; // prk-agavecell cell 3 machine
@lukluk
lukluk / whereJs
Last active August 29, 2015 14:06
//luklukaha@gmail.com
//where.iam() >> get file path and line number where .iam() called
var where=new function(){
this.getErrorObject=function (){
try { throw Error('') } catch(err) { return err; }
}
this.iam=function(){
var err = this.getErrorObject();
var caller_line = err.stack.split("\n")[4];
@lukluk
lukluk / gist:6842aa161d10ddd5976b
Created March 11, 2015 09:12
fixed voucher kosong electro run
<?php
session_start();
setcookie("payment_method","",time()-1);
include_once "include/seating.lib.php";
include_once "include/class_admin.php";
include_once "include/class_organization.php";
include_once "include/class_user.php";
include_once "include/class_event.php";
$query="select * from ee_events_attendees where event_id='2696'";
select b.cardnumber,b.FirstName,b.LastName,a.* from GL_HeldTables a,Members b where a.SDate >= '2015-01-01' and a.Memid=b.membershipid
@lukluk
lukluk / quiz.js.txt
Created October 23, 2015 07:02
Javascript quiz
#1. JS FRONTEND
STORY : saya punya koleksi url dari sebuah API, saya mau mendapat semua hasil dari setiap url yang di pangil secara PARALEL
atau bersamaan
CATATAN : kita tidak ingin mengunakan modul/lib apa pun, semuanya native js
TODO : buatlah function 'getAnyMember' yang akan memberikan callback berserta resultnya
EXAMPLE RESPONSE EACH URL :
{id:1,name:'jhon'}
CLUE :
var url=['http://api.example.com/gold/id/1','http://api.example.com/silver/id/2','http://api.example.com/silver/id/3','http://api.example.com/black/id/4']
@lukluk
lukluk / fullLog.js
Created April 7, 2016 10:28
Complate Console.log
Object.defineProperty(global, '__stack', {
get: function(){
var orig = Error.prepareStackTrace;
Error.prepareStackTrace = function(_, stack){ return stack; };
var err = new Error;
Error.captureStackTrace(err, arguments.callee);
var stack = err.stack;
Error.prepareStackTrace = orig;
return stack;
}