Skip to content

Instantly share code, notes, and snippets.

@dopa
dopa / gist:5245868
Created March 26, 2013 14:42
Shell Script to Back Up all MySQL Databases, Keep 7 Days of Backups
#!/bin/bash
# Script will output dumps for all databases using seperate files
# Derived from this post: http://www.cyberciti.biz/faq/ubuntu-linux-mysql-nas-ftp-backup-script/
USER="root"
PASSWORD="SnM1073k"
HOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
OUTPUT_DIR="/backups/files"
@dopa
dopa / gist:7952215
Created December 13, 2013 22:06
Color Cycle
.color-cycle {
color: hsla(270,95%,69%,0.25) !important
}
@-webkit-keyframes colors {
0% {
color: hsla(270,95%,69%,0.25)
}
15% {
<div class="nested-fields speaker-slot-fields">
<div id="speaker_from_list">
<%= f.association :speaker, :collection => current_organizer.org.speakers(:order => 'name') %>
&nbsp;
<%= link_to_remove_association f, { :class => "dIB vaM" } do %><i class="fui-cross"></i><% end %>
</div>
</div>
<%= simple_form_for([@meeting,@event], :html => {:class => 'form-horizontal' }) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<ul class="tabs">
<li>
<input type="radio" checked name="tabs" id="tab1">
<label class="tab-label" for="tab1">Basics</label>
<div id="tab-c1" class="tab-c animated fadeIn">
@dopa
dopa / gist:7118466
Created October 23, 2013 13:11
Cocoon Events+Speakers Issue Models and Controllers
Thank you!
Relevant parts of models:
class Event < ActiveRecord::Base
  attr_accessible :meeting_id,
                  :session_name,
                  :description,
                  :event_type_id,
                  :start_date_time,
rror: http response not OK: 403
at IncomingMessage.module.exports.send (/home/deployer/production/memecube/node_modules/book-raven/node_modules/raven/lib/transports/http.js:41:27)
at IncomingMessage.EventEmitter.emit (events.js:126:20)
at IncomingMessage._emitEnd (http.js:366:10)
at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:149:23)
at CleartextStream.socketOnData [as ondata] (http.js:1485:20)
at CleartextStream.CryptoStream._push (tls.js:544:27)
at SecurePair.cycle (tls.js:898:20)
at EncryptedStream.CryptoStream.write (tls.js:285:13)
at Socket.ondata (stream.js:38:26)
@dopa
dopa / server.js
Last active December 16, 2015 06:19
Memecube - Nodeproxy server.js
var http = require('http'),
httpProxy = require('http-proxy');
//
// Create an instance of node-http-proxy
//
var proxy = new httpProxy.HttpProxy({
target: {
host: 'localhost',
port: 8124
socket.on('authenticate', function(data) {
var room = '';
socket.userId = data.userId;
connections[socket.userId] = socket; // Must be keyed on userId - that's the whole point
socket.room = room;
socket.join(room);
});
@dopa
dopa / gist:5245856
Created March 26, 2013 14:41
Crontab for Running MySQL Backups Nightly
#
# * * * * * command to be executed
# - - - - -
# | | | | |
# | | | | +- - - - day of week (0 - 6) (Sunday=0)
# | | | +- - - - - month (1 - 12)
# | | +- - - - - - day of month (1 - 31)
# | +- - - - - - - hour (0 - 23)
# +- - - - - - - - minute (0 - 59)
#
@dopa
dopa / gist:5040472
Last active December 14, 2015 06:09
Rails 3 Passenger NGINX Site Config
# www to non-www redirect -- duplicate content is BAD:
# https://github.com/h5bp/html5-boilerplate/blob/5370479476dceae7cc3ea105946536d6bc0ee468/.htaccess#L362
# Choose between www and non-www, listen on the *wrong* one and redirect to
# the right one -- http://wiki.nginx.org/Pitfalls#Server_Name
#server {
# don't forget to tell on which port this server listens
# listen 80;
# listen on the www host
# server_name www.example.com;