Skip to content

Instantly share code, notes, and snippets.

@sasajib
sasajib / Index.php
Created September 23, 2012 19:06 — forked from anonymous/Index.php
Appfog PHPMyadmin
<?php
$secret = "supersecret";
if(isset($_COOKIE['secret']) && $_COOKIE['secret'] == $secret)
{
}
else
{
if(!isset($_GET['secret']))
{
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();
var system = require('system');
if (system.args.length < 5) {
console.info("You need to pass in account name, username, password, and path to casperJS as arguments to this code.");
phantom.exit();
}
var account = system.args[1];
var username = system.args[2];
var password = system.args[3];
// requires
var utils = require('utils');
var casper = require('casper').create()
var casper = require('casper').create({
verbose: true,
logLevel: "debug"
});
// setup globals
var email = casper.cli.options['email'] || 'REPLACE THIS EMAIL';
* Downloaded or downloading
=============================
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html
// Imports required
import java.text.SimpleDateFormat;
import java.text.ParseException;
/**
* Convert a date to a different format.
*
* @param currentFormat The current date format
* @param newFormat The new date format
* @param subject The date that's going to be converted
// Imports required
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
/**
* Read in a file.
*
* @param path The explicit path to the file to read
* @return The contents of the file as a string
// Imports required
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
/**
* Print a result set to system out.
*
* @param rs The ResultSet to print
* @throws SQLException If there is a problem reading the ResultSet
@sasajib
sasajib / ucfirst.java
Last active August 29, 2015 14:08 — forked from jimjam88/ucfirst.java
/**
* Mimics PHP's ucfirst function.
*
* @param subject The string to be ucfirst'd
* @return The subject string with an uppercased first character
*/
final public static String ucfirst(String subject)
{
return Character.toUpperCase(subject.charAt(0)) + subject.substring(1);
}
/**
* Convert a fractinal price to a decimal price.
*
* @param string $fractional
* @return string
*/
public static function fractional2decimal($fractional)
{
list ($numerator, $denomenator) = explode('/', $fractional);
return number_format(($numerator / $denomenator) + 1, 2, '.', '');