Skip to content

Instantly share code, notes, and snippets.

overallScreenWidth = Ti.Platform.displayCaps.getPlatformWidth();
if (OS_ANDROID) {
overallScreenWidth = Ti.Platform.displayCaps.platformWidth / Ti.Platform.displayCaps.logicalDensityFactor;
}
color = {
HSBToRGB: function(hsb) {
var rgb = {},
h = Math.round(hsb.h),
s = Math.round(hsb.s * 255 / 100),
v = Math.round(hsb.b * 255 / 100);
if (s == 0)
rgb.r = rgb.g = rgb.b = v;
else {
var t1 = v,
@jcsrb
jcsrb / wp-install.php
Created August 21, 2013 12:53
a little script that downloads and extracts wordpress
<?php
// CONFIGURE YOUR INSTALL HERE
echo "<pre>";
echo "Step 0: Initalization";
$install_folder = "wordpress";
$wordpress_archive_url = "http://wordpress.org/latest.zip";
echo " - done \r\n";
// Execute
@jcsrb
jcsrb / header.html
Created August 1, 2013 09:48
mobile first but don't want to show IE8 the mobile version?
<link rel='stylesheet' href='mobile.css' type='text/css' />
<link rel='stylesheet' href='desktop.css' type='text/css' media='(min-width: 961px)' />
<!--[if lt IE 9]>
<link rel='stylesheet' href='desktop.css' type='text/css' />
<![endif]-->
@jcsrb
jcsrb / dabblet.css
Created July 15, 2013 14:18
Untitled
body {
font-size: 2vw;
}
h1{
font-size: 2em;
}
/* http://twitter.github.com/bootstrap/scaffolding.html#responsive */
/* Landscape phones and down */
@media (max-width: 480px) { ... }
/* Landscape phone to portrait tablet */
@media (max-width: 768px) { ... }
/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 940px) { ... }
@jcsrb
jcsrb / gist:5569905
Last active December 17, 2015 06:59
this screams for metaprogramming
scope :created_this_hour , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_hour}' AND '#{DateTime.now.end_of_hour}'") }
scope :created_this_day , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_day}' AND '#{DateTime.now.end_of_day}'") }
scope :created_this_week , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_week}' AND '#{DateTime.now.end_of_week}'") }
scope :created_this_month , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_month}' AND '#{DateTime.now.end_of_month}'") }
scope :created_this_quarter , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_quarter}' AND '#{DateTime.now.end_of_quarter}'") }
scope :created_this_year , lambda { where("created_at BETWEEN '#{DateTime.now.beginning_of_year}' AND '#{DateTime.now.end_of_year}'") }
/*-----------------------------------------------------------------------------------*/
/* Optionally load top navigation. */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_top_nav' ) ) {
function woo_top_nav () {
if ( function_exists( 'has_nav_menu' ) && has_nav_menu( 'top-menu' ) ) {
?>
<div id="top">
@jcsrb
jcsrb / new_gist_file
Created March 27, 2013 14:25
Synaptic pressure thresholds
#default pressure sensor
xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Finger" 25 30 255
#fix for jumping cursor when riding the train
xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Finger" 50 68 255
@jcsrb
jcsrb / gist:5144678
Last active December 14, 2015 20:29
too many steps

Vote for me - Too many steps

Today a friend send me a link to vote on a thing she submitted to Beck's "design your own cover" type of thing

here are the steps I had to take to vote

  1. Link the link from her
  2. Login with Facebook
  3. Allow them to post on my behalf (clicked skip but the app wouldn't register)
  4. Add a phone number and password to the account