Skip to content

Instantly share code, notes, and snippets.

@cemerson
cemerson / terminal
Created October 7, 2012 12:25
Cordova: Create New Project
./create <project_folder_path> <package_name> <project_name>
@cemerson
cemerson / mobile.css
Created October 8, 2012 20:02
CSS: Device Orientation/Retina Media Queries
/*
Note: Normally let javascript determine iphone 4, iphone 5, ipad etc
and use the below queries in separate iphone.css, iphone5.css,
ipad.css files !as needed!. */
/* RETINA styles (LANDSCAPE) */
@media all and (orientation:landscape) and (-webkit-min-device-pixel-ratio: 2) {
}
@cemerson
cemerson / autosave_nodejs.txt
Created October 9, 2012 12:22
REF: Chrome AutoSave with NodeJS
/*
Setting up Chrome DevTools AutoSave with NodeJS!
Source: http://addyosmani.com/blog/autosave-changes-chrome-dev-tools
OSX Batch: https://github.com/NV/chrome-devtools-autosave-server/blob/master/README.mdown
My Install Notes: For any poor saps on Windows (like me) - the path was a bit bumpy
to get this working. Here are my notes that got it working for me
on Windows 7 x64.
@cemerson
cemerson / Fetch.sublime-settings
Created October 12, 2012 09:40 — forked from dustinhorton/Fetch.sublime-settings
REF: Fetch settings for Sublime Text 2
{
"files":
{
"jquery" : "http://code.jquery.com/jquery.min.js",
"jquery-ui-effects" : "https://raw.github.com/jquery/jquery-ui/master/ui/jquery.effects.core.js",
"jquery-mobile-vmouse" : "https://raw.github.com/jquery/jquery-mobile/master/js/jquery.mobile.vmouse.js",
"jquery-flexslider" : "https://raw.github.com/mbmufffin/FlexSlider/master/jquery.flexslider-min.js",
"jquery-mediaelement" : "https://raw.github.com/johndyer/mediaelement/master/build/mediaelement-and-player.js",
"jquery-url" : "https://raw.github.com/allmarkedup/jQuery-URL-Parser/master/jquery.url.js",
"jquery-dotimeout" : "https://raw.github.com/cowboy/jquery-dotimeout/master/jquery.ba-dotimeout.min.js",
@cemerson
cemerson / H5BPBS
Created October 12, 2012 09:43
REF: (ST2: Build Script) HTML5 Boilerplate
So I haven't seen anybody create a html5 boilerplate build system for sublime so here is a really simple one!
Just make sure ant is in your PATH vars and it should work based on if you keep your build folder in the root of your project.
{
"cmd" : ["ant", "-buildfile", "$file_path\\build\\build.xml"],
"selector": "source.html",
"windows": {
"cmd" : ["ant.bat", "-buildfile", "$file_path\\build\\build.xml"]
}
@cemerson
cemerson / Default.aspx.cs
Created October 12, 2012 12:18
C#: NEW FUNCTION (boolean)
/* ---------------------------------------- /
/ FUNCTION_NAME()
/ --------------------------------------- */
public bool FUNCTION_NAME(){
bool isTrue = false;
try{
// function code here
isTrue = true;
@cemerson
cemerson / detection.txt
Created October 17, 2012 00:37
REF: PhoneGap/iOS iPhone 5 Detection
try http://github.com/erica/uidevice-extension/
[[UIDevice currentDevice] platformType] // ex: UIDevice4GiPhone
[[UIDevice currentDevice] platformString] // ex: @"iPhone 4G"
or you can just watch screenHeight like:
float screenHeight = [UIScreen mainScreen].bounds.size.height;
for the iPhone 5 height is 568
and maybe you shell to set nib if you load with an .xib like:
@cemerson
cemerson / mysql.aspx.cs.txt
Created October 17, 2012 09:51
C#: MYSQL Stored Procedure with Params
From: http://forums.asp.net/t/1796878.aspx/1
Calling a mysql stored procedure in c# | Apr 25, 2012 02:38 PM|LINK
I spent several hours banging my head against the wall on this because everywhere I looked it said to do it a certain way and no matter what I tried I could not get it to work. Finally I tried a different what that I hadnt seen anyone post anywhere that I could find (not saying its not out there just that I couldnt find it. So Im posting my solution in case anyone out there runs into the same headache I did.
string conn = "server=servername;database=0000;Persist Security Info=True;User Id=username;password=pwrd";
MySqlConnection sql_conn = new MySqlConnection(conn);
MySqlCommand cmd = new MySqlCommand();
@cemerson
cemerson / 3_inner_join.sql
Created October 17, 2012 09:58
SQL: Inner Join 3 Tables
SELECT a.id as club_id,
a.fr_name as club_name,
b.id as nation_id,
b.fr_name as nation_name,
c.id as player_id,
c.fr_fname as player_name
FROM fr_clubs as a
INNER JOIN fr_nations as b
ON a.id = b.club_id
@cemerson
cemerson / no_cache.aspx.cs
Created October 17, 2012 17:39
C#: Prevent Page Caching
Method 1:
//Response.ClearHeaders();
//Response.AppendHeader("Cache-Control", "no-cache"); //HTTP 1.1
//Response.AppendHeader("Cache-Control", "private"); // HTTP 1.1
//Response.AppendHeader("Cache-Control", "no-store"); // HTTP 1.1
//Response.AppendHeader("Cache-Control", "must-revalidate"); // HTTP 1.1
//Response.AppendHeader("Cache-Control", "max-stale=0"); // HTTP 1.1
//Response.AppendHeader("Cache-Control", "post-check=0"); // HTTP 1.1
//Response.AppendHeader("Cache-Control", "pre-check=0"); // HTTP 1.1
//Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.1