Skip to content

Instantly share code, notes, and snippets.

View arisetyo's full-sized avatar
💭
To live is to create. And to create is immortality.

Arie M. Prasetyo arisetyo

💭
To live is to create. And to create is immortality.
View GitHub Profile
@arisetyo
arisetyo / basic_json_jquery.js
Created November 8, 2012 06:46
simple JSON retrieving and displaying with jQuery
$(document).ready(function(){
getMembers();
});
function getMembers() {
$('#list').html(" ");
$("#monitor").html("<span>loading...</span>");
$.ajax({
type: 'GET',
@arisetyo
arisetyo / hello_ko.html
Created November 9, 2012 03:11
Introduction to Knockout.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hello-knockout-js</title>
</head>
<body>
<!-- syntax: data-bind="bindingName: bindingValue"-->
<p>Day: <input data-bind="value: dayOfWeek" /></p>
@arisetyo
arisetyo / basic_threejs.html
Created November 9, 2012 05:32
Basic Three.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hello-three-js</title>
</head>
<body>
<script type='text/javascript' src='three.min.js'></script>
@arisetyo
arisetyo / basic_greensock.html
Created November 13, 2012 06:09
A simple animation using the Greensock for JS library
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Basic Greensock</title>
<script src="minified/TweenMax.min.js"></script>
<script type="text/javascript">
@arisetyo
arisetyo / car.js
Created November 13, 2012 06:35
Object-Oriented Programming in JavaScript
(function(window) {//catch the window argument
//public variables, outside the constructors
Car.prototype.kpl = 20;//"kilometers per liter"
//a public static property example
Car.music_player = "Kenwood";
function Car(make, model, color) {//the object constructor
/*
@arisetyo
arisetyo / html_excerpt.html
Created November 16, 2012 13:02
HTML5 Audio Player with Knockout.js Playlist
<audio id="audioplayer" controls="controls" autoplay="autoplay" data-bind="attr:{src: selectedFile}"></audio>
<p>Selected song: <span id="audioplayer" data-bind="text: selectedSong"></span></p>
<img data-bind="attr:{src: selectedCover}" width="200"/>
<tbody data-bind="foreach: availableSongs">
<tr>
<td data-bind="text: artist"></td>
<td><img data-bind="attr:{src: cover}" width="60"/>&nbsp;<span data-bind="text: album"></span></td>
<td data-bind="text: title"></td>
<td><a href="#" data-bind="click: $root.selectSong">PLAY</a></td>
@arisetyo
arisetyo / basic_webcam.html
Created November 29, 2012 04:09
webcam access
<video autoplay></video>
<script type="text/javascript">
function hasGetUserMedia() {
// Note: Opera is unprefixed.
return !!(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);
}
if(hasGetUserMedia()) console.log("Good to go!");
else alert("boohoo... getUserMedia() is not supported in your browser.. :(");
@arisetyo
arisetyo / the_photo_grid.html
Created November 29, 2012 04:31
Experiment with Instagram API, jQuery, and Knockout.js
<tbody data-bind="foreach: photoList">
<tr>
<td>
<span>user: </span><strong><span data-bind="text: user.username"></span></strong><br/>
<span data-bind="text: 'created_time at '+created_time"></span><br/>
</td>
<td>
<img data-bind="attr:{src: images.thumbnail.url}" width="90"/>&nbsp;&nbsp;
<a href="#myModal" role="button" class="btn btn-primary btn-large" data-toggle="modal" data-bind="click: $root.showLargeImage">View</a>
</td>
@arisetyo
arisetyo / sample_fb.php
Created December 17, 2012 12:13
example of using the Facebook PHP SDK
<?php
require '../facebook-php-sdk/src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
));
$redirecturl = "REDIRECT_URL_AFTER_LOGIN_(THIS_FILE_FOR_THIS_EXAMPLE)";
@arisetyo
arisetyo / thumbgenerator.php
Created December 17, 2012 13:39
Thumbnail generator using PHP
<?php
function CreateThumb($file, $photo_url) {
$square_size = 160;
$quality = 100;
//GET THE SOURCE IMAGE'S METADATA
if($photo_url!="") list($width, $height, $type, $attr) = getimagesize($photo_url);