Skip to content

Instantly share code, notes, and snippets.

@et4891
et4891 / gist:7653187
Last active December 29, 2015 09:49
FIle API - Phonegap (File List In Directory)
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is ready
//
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);
}
function onFileSystemSuccess(fileSystem) {
fileSystem.root.getDirectory("Music", {create: false, exclusive: false}, getDirSuccess, fail);
@et4891
et4891 / snippet.js
Created November 26, 2013 04:12
File API (Listing Files In Directory) From EionRobb in phonegap IRC
window.requestFileSystem
(
LocalFileSystem.PERSISTENT,
512000,
function(fs)
{
fs.root.createReader().readEntries
(
function(entries)
{
@et4891
et4891 / accelerometer.js
Last active December 30, 2015 05:49
Canvas + Accelerometer *http://www.lonhosford.com/lonblog/* From html and simplified into only js file
var canvas_ctx; // HTML canvas 2d context
var ax = 0; // Acceleration x axis (Accelerometer value adjusted for direction)
var ay = 0; // Acceleration y axis (Accelerometer value adjusted for direction)
var x; // Circle x position
var y; // Circle y position
var vx = 0; // Velocity x axis
var vy = 0; // Velocity y axis
var WIDTH = 320; // Width of canvas
var HEIGHT = 300; // Height of canvas
var RADIUS = 10; // Width of circle object
@et4891
et4891 / accelerometer.js
Created December 5, 2013 07:00
Canvas 2d Circle + Accelerometer API (still need lots editing)
// The watch id references the current `watchAcceleration`
var watchID = null;
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
//
function onDeviceReady() {
@et4891
et4891 / index.html
Created February 10, 2014 09:26
CSS Slide Out Navigation using a little jquery
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CSS slide out menu</title>
<link rel="stylesheet" href="css/main.css">
<script src="js/jquery.js"></script>
<script>
@et4891
et4891 / renameFiles.php
Created October 30, 2014 06:17
rename all files in a directory with same extentions
<?php
// open the current directory (change this to modify where you're looking)
$dir = opendir('.');
$i = 1;
// loop through all the files in the directory
while (false !== ($file = readdir($dir)))
{
// if the extension is '.jpg'
@et4891
et4891 / renameFileExtension-samePath.php
Last active August 29, 2015 14:08
Rename File Extention Only in Same Directory
<?php
// open the current directory (change this to modify where you're looking)
$dir = opendir('.');
// loop through all the files in the directory
while (false !== ($file = readdir($dir)))
{
// if the extension is '.jpg'
if (strtolower(pathinfo($file, PATHINFO_EXTENSION)) == 'html')
{
@et4891
et4891 / renameFilesExtensions-AllPaths.php
Created October 30, 2014 21:39
Rename File Extention Only in Root All Sub Directories
<?php
// root path
$path = realpath('.');
// finds everything in $path including root directory
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
// each objects as $file if echo $file files will be printed
foreach($objects as $file => $object){
// if the extension is '.jpg'
@et4891
et4891 / renameFilesExtension-AllPaths-With-Stats.php
Created October 30, 2014 21:40
Rename File Extention Only in Root All Sub Directories - with Stats
<?php
// root path
$path = realpath('.');
// finds everything in $path including root directory
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
$success = 0;
$error = 0;
$skipped = 0;
@et4891
et4891 / Preferences.sublime-settings
Created December 3, 2014 09:43
ST2 User-Setting
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"folder_exclude_patterns":
[
".svn",
".hg",
"CVS"
],
"font_size": 9.0,
"ignored_packages":