Skip to content

Instantly share code, notes, and snippets.

@dodyw
dodyw / forceportrait.m
Created February 11, 2014 06:50
force portrait
- (void)forcePortrait
{
if (UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation]))
{
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)])
{
int orientationPortrait = UIInterfaceOrientationPortrait;
NSMethodSignature *sig = [[UIDevice currentDevice] methodSignatureForSelector:@selector(setOrientation:)];
NSInvocation* invo = [NSInvocation invocationWithMethodSignature:sig];
[invo setTarget:[UIDevice currentDevice]];
@dodyw
dodyw / uiLabelHeight.m
Created February 13, 2014 10:32
get uilable height
CGSize valSize = [val.text sizeWithFont:val.font
constrainedToSize:val.frame.size
lineBreakMode:UILineBreakModeWordWrap];
CGFloat valHeight = valSize.height;
@dodyw
dodyw / Vagrantfile
Created February 24, 2014 09:17
vagrant setting, set permission to shared folder
# Vagrant v1.1+
config.vm.synced_folder "./", "/var/sites/dev.query-auth", id: "vagrant-root",
owner: "vagrant",
group: "www-data",
mount_options: ["dmode=775,fmode=664"]
@dodyw
dodyw / pod
Created February 26, 2014 14:56
Fix cocoapod bug per Jan 2014
pod repo remove master
pod setup
@dodyw
dodyw / eloquent.php
Last active August 29, 2015 14:06 — forked from ziadoz/eloquent.php
<?php
class Post
{
protected $table = 'posts';
/**
* You can define your own custom boot method.
*
* @return void
**/
@dodyw
dodyw / ob.php
Created October 29, 2014 22:50
This is taken from indexu 7 (categorypage.php)
// this is on top
ob_start();
// this is the content
..
..
..
@dodyw
dodyw / MyClickAction.java
Created January 24, 2015 11:03
Detect onclick event from imageview using interface
package com.dodyrw.mpos;
/**
* Created by dodyrw on 1/14/15.
*/
public interface MyClickAction {
void onImageClick(int position);
}
<?php
/*
* Plugin Name: My Name Email
* Description: Use custom email From Name
* Plugin URI: http://toscho.de/?p=2201
* Version: 2015.01.28
* Author: Dody Rachmat Wicaksono
* Author URI: http://www.dodyrw.com
* License: GPL
*/
@dodyw
dodyw / MyListAdapter.java
Last active August 29, 2015 14:14
masalah dg redraw lisview / repeating
package com.dwidasa.mpos;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
@dodyw
dodyw / function_category.php
Created September 27, 2011 22:56
indexu bug fix #18 Links Count Bug
function cat_build_stat($category_id) {
global $lep;
$children = cat_get_children($category_id);
$children[] = $category_id;
$children_str = implode(', ',$children);
$query = "select count(res_id) from lep_resource where category_id in ($children_str) and suspended = 0 and status = 1";
$num_res = $lep->db->GetOne($query);