Skip to content

Instantly share code, notes, and snippets.

View jimmysawczuk's full-sized avatar

Jimmy Sawczuk jimmysawczuk

View GitHub Profile
@jimmysawczuk
jimmysawczuk / CSS_pre_less.css
Created November 24, 2011 05:57
LESS blog post examples
#header { background-color: silver; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; }
#header h1 { color: black; font-weight: bold; font-family: 'ChunkFive'; }
#header h1 a { text-decoration: none; }
#header h1 a:hover { text-decoration: underline; }
@jimmysawczuk
jimmysawczuk / pretty_numbers.js
Created December 6, 2011 21:40
Pretty numbers in Javascript
function pretty_number(num, opts)
{
var defaultOpts = {
short: true,
lowerCase: false,
addCommas: true,
round: 2
};
if (typeof num != "number")
@jimmysawczuk
jimmysawczuk / findInArray.js
Created January 17, 2012 21:42
find object in array search engine
<script type="text/javascript">
function findInArray(needle, haystack)
{
function isMatch(needle, haystack)
{
if (haystack == needle)
{
return true;
}
else if (typeof needle == 'object' && typeof haystack == 'object')
@jimmysawczuk
jimmysawczuk / lunch.coffee
Created January 18, 2012 16:37
lunch hubot script
destinations = [
"Thirsty Fellow"
"Mellow Mushroom"
"Pawley's"
"Mucho Margarita"
"Harpers"
"Mr. Friendlys"
"M Vista"
"Wild Wing"
"Chipotle"
@jimmysawczuk
jimmysawczuk / function.js
Created January 18, 2012 22:53
make confirm javascript
function makeConfirm(orig, confirm_callback, prompt, confirm_text, cancel_text)
{
if (typeof prompt == "undefined")
{
prompt = "Are you sure?";
}
if (typeof confirm_text == "undefined")
{
confirm_text = "Yes";
@jimmysawczuk
jimmysawczuk / mixins.less
Created January 25, 2012 21:37
Facebook style buttons
.button3d() {
background-color: #69A74E; background-position: 0 -96px; color: white; box-shadow: 0 1px 0 rgba(0, 0, 0, .1); -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, .1); cursor: pointer; padding: 3px 6px 4px; border: 1px solid #999; border-color: #3B6E22 #3B6E22 #2C5115; font-weight: bold; font-size: 13px; font-family: "Lucida Grande", Tahoma, Verdana, sans-serif; background: #98C286; background: -moz-linear-gradient(top, #98C286 0%, #73AC59 15%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#98C286), color-stop(15%,#73AC59)); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#98C286', endColorstr='#73AC59',GradientType=0 );
&:active { background: #69A74E; }
}
.button3d_green() {
.button3d;
}
{"cities":[{"region":"Ontario","country":"ca","id":2674270,"value":"Maple"},{"country":"in","id":1016524,"value":"Aonla"},{"region":"England","country":"gb","id":806089,"value":"Corby"},{"country":"it","id":1184687,"value":"Monopoli"},{"country":"id","id":963293,"value":"Jatiroto"},{"country":"jp","id":1213374,"value":"Tateyama"},{"country":"dk","id":611673,"value":"Horsens"},{"country":"it","id":1174394,"value":"Ascoli Piceno"},{"country":"br","id":272094,"value":"Taquaritinga"},{"country":"in","id":1019754,"value":"Bhongir"},{"region":"California","country":"us","id":2422568,"value":"Tulare"},{"country":"mx","id":1560573,"value":"Zacapú"},{"region":"Minnesota","country":"us","id":2471434,"value":"Minnetonka"},{"region":"Ohio","country":"us","id":2499384,"value":"Euclid"},{"country":"es","id":692604,"value":"Paterna"},{"region":"Connecticut","country":"us","id":2424730,"value":"East Hartford"},{"country":"es","id":679229,"value":"Castelldefels"},{"region":"Ontario","country":"ca","id":295194,"value":"North B
@jimmysawczuk
jimmysawczuk / example.php
Created June 30, 2012 02:42
Command-line flag parsing/HTTP Request parsing class
<?php
// Example use
require('flag.php');
Flag::boolFlag("all", "Whether or not to go back and get all 90 days worth of data", false);
Flag::stringArg("jobID", "ID of the job", "");
Flag::stringArg("groupId", "ID of the group", "");
$backprop = Flag::lookup("all");
$job_name = Flag::lookupArg("job");
<!DOCTYPE html>
<html>
<head>
<title>Louddoor</title>
</head>
<body>
<div id="container">
<div id="navbar">
<ul>
<li>Link 1</li>