Skip to content

Instantly share code, notes, and snippets.

@jakeasmith
jakeasmith / gist:1638712
Created January 19, 2012 08:18
CSV to MySQL.
LOAD DATA LOCAL INFILE ‘/your_file.csv’
INTO TABLE your_table
FIELDS TERMINATED BY ‘,’
LINES TERMINATED BY ‘\n’
(field1, filed2, field3);
@jakeasmith
jakeasmith / rounded-corners.css
Created January 19, 2012 23:06
Rounded corners
.rounded {
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
@jakeasmith
jakeasmith / Fetch.sublime-settings
Created January 20, 2012 00:09
Sublime Text 2 | Fetch settings
{
"files":
{
"Backbone.js": "http://documentcloud.github.com/backbone/backbone-min.js",
"Backbone.js (AMD Fork)": "https://raw.github.com/amdjs/backbone/master/backbone-min.js",
"Underscore.js": "https://raw.github.com/documentcloud/underscore/master/underscore-min.js",
"Underscore.js (AMD Fork)": "https://raw.github.com/amdjs/underscore/master/underscore-min.js",
"jQuery": "http://code.jquery.com/jquery.min.js",
"jQuery color": "https://github.com/jquery/jquery-color/blob/master/jquery.color.js",
"require.js": "http://requirejs.org/docs/release/1.0.5/minified/require.js",
@jakeasmith
jakeasmith / lazy_loading_example.php
Created January 20, 2012 23:02
Lazy loading class inside class
<?php
class book
{
// Singular author
private $_author = null;
public function author()
{
if(is_null($this->_author))
{
@jakeasmith
jakeasmith / process_variations.php
Created June 21, 2012 21:25
Build an array of strings with every possible variation of multiple other strings
<?php
$foo = array(
array(
'Black',
'White',
'Green'
),
array(
'Small',
@jakeasmith
jakeasmith / Preferences.sublime-settings
Created July 7, 2012 17:19
Sublime Text 2 User Preferences
// While you can edit this file, it's best to put your changes in
// "User/Preferences.sublime-settings", which overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Blackboard.tmTheme",
// Valid options are "no_bold", "no_italic", "no_antialias", "gray_antialias",
@jakeasmith
jakeasmith / coupon_generator.php
Created November 30, 2012 16:26
Random string generator
<?php
/*
* Coupon code generator
*/
$num_of_coupons_to_generate = 100;
$coupon_count = 0;
while($coupon_count != $num_of_coupons_to_generate)
@jakeasmith
jakeasmith / form.html
Created December 25, 2012 08:17
Regex example for dont-know.it
<select>
<option value="ME">Maine</option>
<option value="FL">Florida</option>
</select>
@jakeasmith
jakeasmith / gist:4964318
Last active December 13, 2015 19:38
Super simple example of how to implement a system that can handle multiple types of fraud checks
<?php
/*
* Fraud levels:
* 0 - no fraud
* 1 - needs to be reviewed
* 2 - denied
*/
// Set the initial fraud status to zero
@jakeasmith
jakeasmith / status_check.sh
Last active December 15, 2015 01:29
I threw this together to monitor an intermittent LB issue tonight. It works beautifully.
#!/bin/bash
# Usage: ./command.sh http://www.google.com
# Help: Returns the HTTP status code for a given URL every 2 seconds
txtred=$(tput setaf 1) # Red
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue
txtpur=$(tput setaf 5) # Purple