Skip to content

Instantly share code, notes, and snippets.

View saturngod's full-sized avatar
🎯
Focusing

Htain Lin Shwe saturngod

🎯
Focusing
View GitHub Profile
@saturngod
saturngod / bubblesort.mm
Last active August 29, 2015 14:03
Bubble Sort
NSMutableArray *res2 = [[NSMutableArray alloc] initWithArray:@[@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23,@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23,@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23,@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23]];
int passnum = res2.count -1 ;
BOOL exchange = YES;
NSDate *date = [NSDate date];
while (passnum >0 && exchange) {
exchange = false;
for (int i = 0 ; i < passnum ; i++)
//Passing Attribute with jquery 1.4
jQuery('<a/>', {
id: 'foo',
href: 'http://google.com',
title: 'Become a Googler',
rel: 'external',
text: 'Go to Google!'
});
jQuery('<div/>', {
<?php
//download from http://svn.facebook.com/svnroot/platform/clients/packages/facebook-platform.tar.gz
//include_once 'fbconnect/config.php'; //has $api_key and $secret defined.
include_once 'facebook/facebook.php';
//global $api_key,$secret;
$appapikey = '';
$appsecret = '';
//Start Facebook
$fb=new Facebook($appapikey,$appsecret);
$fb_user=$fb->get_loggedin_user();
<html>
<head>
<title>Sample Ajax</title>
<script src="http://code.jquery.com/jquery-1.5.2.min.js" ></script>
<script>
$(document).ready(function(){
$("#ajaxtest").click(function(){
var data = [];
@saturngod
saturngod / checkbox.html
Created April 6, 2011 02:48
check box with form for php
<html>
<head>
<title>checkbox</title>
</head>
<body>
<form action="test.php" method="post">
<input type="checkbox" name="chk[]" value="1"/>Check1<br/>
<input type="checkbox" name="chk[]" value="2"/>Check1<br/>
<input type="checkbox" name="chk[]" value="3"/>Check1<br/>
<input type="submit" value="Submit"/>
@saturngod
saturngod / apc_store.php
Created April 18, 2011 04:12
php apc with sql
<?php
$sql="select * from `prize`";
if (apc_exists($sql)) {
print_r( apc_fetch($sql) );
}
else {
$result=mysql_query($sql);
while ($row = mysql_fetch_assoc($user_result)) {
<?php
//after insert or delete or update
$sql="select * from `prize`";
apc_delete($sql);
?>
@saturngod
saturngod / plist2json.py
Created April 24, 2011 09:24
Plist to Json
import json
from plistlib import readPlist
import StringIO
plist = open("source.plist","r").read()
in_file = StringIO.StringIO(plist)
plist_dict = readPlist(in_file)
open("source.json","w").write(json.dumps(plist_dict))
@saturngod
saturngod / mediaqueries.css
Created May 12, 2011 15:35
Media queries
@media screen and (max-width:480px){
#content {
width:470px;
}
}
@media screen and (max-width:320px){
@saturngod
saturngod / model.py
Created May 15, 2011 04:54
database queries in django
class Blog(models.Model):
name = models.CharField(max_length=100)
tagline = models.TextField()
def __unicode__(self):
return self.name
class Author(models.Model):
name = models.CharField(max_length=50)
email = models.EmailField()