Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mrsweaters
mrsweaters / timedout.md
Created August 26, 2015 17:54
EC2 Operation Timed Oout

[EC2-VPC] Check the route table for the subnet. You need a route that sends all traffic destined outside the VPC (0.0.0.0/0) to the Internet gateway for the VPC.

Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

In the Description tab, write down the values of VPC ID and Subnet ID.

Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.

In the navigation pane, click Internet Gateways. Verify that there is an Internet gateway attached to your VPC. Otherwise, click Create Internet Gateway and follow the directions to create an Internet gateway, select the Internet gateway, and then click Attach to VPC and follow the directions to attach it to your VPC.

# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@mrsweaters
mrsweaters / SassMeister-input.scss
Created February 1, 2014 00:50
Generated by SassMeister.com.
// ----
// libsass (v0.7.0)
// ----
$namespace: false !default;
@function data($attr) {
@if $namespace {
@return '[data-' + $namespace + '-' + $attr + ']';
}
@mrsweaters
mrsweaters / object_key_matcher.js
Last active August 29, 2015 13:56
find match in object keys
function(attrs, exp) {
if (typeof attrs === 'object' && attrs !== null) {
var keys = Object.getOwnPropertyNames(attrs),
i = keys.length,
type = '';
while (i--) {
var attr = attrs[keys[i]];
if (typeof attr === 'object') {
@mrsweaters
mrsweaters / utf8.sql
Created March 3, 2014 18:40
convert mysql database to utf 8
ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
@mrsweaters
mrsweaters / backup_and_restore.sql
Created March 3, 2014 18:41
backup and restory mysql database
backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql
@mrsweaters
mrsweaters / at_least_one.js
Created May 7, 2014 02:31
At least one checkbox checked.
$(document).on('valid', '[data-abide]', function () {
var vehicles = $('input:checked', this);
if (vehicles.length > 0) {
// post your form via ajax
} else {
// show custom error message.
}
});
@mrsweaters
mrsweaters / line.js
Created May 21, 2014 21:28
Custom Pizza Line Labels
$.extend(Pizza, {
line : function (legend) {
var settings = legend.data('settings'),
svg = this.svg(legend, settings),
container = $(this.identifier(legend)),
width = container.outerWidth(),
height = container.outerHeight(),
data = legend.data('graph-data'),
max_x = max_y = min_x = min_y = total_x = total_y = 0,
i = data.length,
@mrsweaters
mrsweaters / gist:761e87a55bab02a6a5a0
Created June 13, 2014 21:05
Update Collation in MySQL
mysql> show table status;
```
+----------+--------+-------------------+ ..
| Name | Engine | Collation | ..
+----------+--------+-------------------+ ..
| my_table | InnoDB | latin1_swedish_ci | ..
```
Therefore I altered the character set of the table directly:
@mrsweaters
mrsweaters / calendar.html.erb
Last active August 29, 2015 14:03
rub calendar
<ul class="large-block-grid-7">
<% month = (params[:month] || Date.today.month).to_i %>
<% first_day_of_week = DateTime.new(2014, month, 01).strftime('%w').to_i.times.each do |i| %>
<li>blank</li>
<% end %>
<% Time.days_in_month(month, 2014).times.each do |i| %>
<li><%= Date.new(2014, month, 01) + i.day %>
<% end %>
</ul>