Skip to content

Instantly share code, notes, and snippets.

View Josh-Miller's full-sized avatar

Josh Miller Josh-Miller

  • Finn Ridge Capital
View GitHub Profile
// strip-units required by spread mixin
// http://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass
@function strip-units($number)
@return $number / ($number * 0 + 1)
// pow and sqrt required by ease function
// adapted from https://github.com/at-import/Sassy-math/blob/master/sass/math.scss
@function pow($base, $exponent)
$value: $base
<?php
/**
* Implements hook_preprocess_views_view_unformatted().
*/
function YOUR_THEME_preprocess_views_view_unformatted(&$variables) {
// Determine if this view's content should render in columns.
// @see: _YOUR_THEME_views_columns();
_YOUR_THEME_views_columns($variables, array(
'articles|page' => 2,
@Josh-Miller
Josh-Miller / MessageLoad.js
Created May 3, 2013 21:20
Appcelerator loading window, loads an activity indicator (will add text to this later). Works for both iOS and Android.
function MessageWindow() {
var win = Titanium.UI.createWindow({
height:80,
width:175,
borderRadius:10,
touchEnabled:false,
zIndex: 999999999,
backgroundColor:'#ccc',
opacity: 0.7,
borderColor: '#999',
var url = "http://maps.google.com/maps/ms?ie=UTF&msa=0&msid=217110902183005084784.00049d962454fabcabdc2&output=kml";
//Add routes from a remote KML file to one map
goog.maps.kml.addRoutesToMap(mySingleMap, url);
//Multiple Maps
goog.maps.kml.addRoutesToMap([myGoogleMap1, myGoogleMap2], url);
@Josh-Miller
Josh-Miller / password_hashing_api.md
Created September 13, 2012 17:34 — forked from nikic/password_hashing_api.md
The new Secure Password Hashing API in PHP 5.5

The new Secure Password Hashing API in PHP 5.5

The [RFC for a new simple to use password hashing API][rfc] has just been accepted for PHP 5.5. As the RFC itself is rather technical and most of the sample codes are something you should not use, I want to give a very quick overview of the new API:

Why do we need a new API?

Everybody knows that you should be hashing their passwords using bcrypt, but still a surprising number of developers uses insecure md5 or sha1 hashes (just look at the recent password leaks). One of the reasons for this is that the crypt() API is ridiculously hard to use and very prone to programming mistakes.

@Josh-Miller
Josh-Miller / pnginator.rb
Created August 7, 2012 18:57 — forked from gasman/pnginator.rb
pnginator: pack Javascript into a self-extracting PNG
#!/usr/bin/env ruby -w
# pnginator.rb: pack a .js file into a PNG image with an HTML payload;
# when saved with an .html extension and opened in a browser, the HTML extracts and executes
# the javascript.
# Usage: ruby pnginator.rb input.js output.png.html
# By Gasman <http://matt.west.co.tt/>
# from an original idea by Daeken: http://daeken.com/superpacking-js-demos
@Josh-Miller
Josh-Miller / app.js
Created July 5, 2012 17:41 — forked from dawsontoth/app.js
Customize the look of the tab bar in iOS Appcelerator Titanium
Ti.include('overrideTabs.js');
/*
This is a typical new project -- a tab group with three tabs.
*/
var tabGroup = Ti.UI.createTabGroup();
/*
Tab 1.
@Josh-Miller
Josh-Miller / test1.js
Created June 25, 2012 16:16 — forked from pec1985/test1.js
Optimizing Appcelerator's Titanium
/**
* Test #1
* Adding 10,000 Ti.UI.TableViewRows to a Ti.UI.TableView
* The rows have the Ti.UI.iPhone.TableViewCellSelectionStyle.BLUE constant in them
*
* Total time in my Mac: 1228ms
*/
var win = Ti.UI.createWindow({
backgroundColor: '#ccc'
@Josh-Miller
Josh-Miller / app.js
Created June 1, 2012 17:56 — forked from KarthiPnsmy/app.js
Create Album and Post Photos in Facebook Using Appcelerator Titanium
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
//FACEBOOK CREDENTIAL
Titanium.Facebook.appid = "134793934930";
Titanium.Facebook.permissions = ['publish_stream', 'read_stream'];
//
// create root window
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"