#Dump and Restore MySQL DB Quick Ref
##Dump The MySQL Table
mysqldump -u username -p -r my_output.sql my_database
##Compress Output with 7zip using the PPMd Algorithm
7z a -t7z my_output.7z my_output.sql -m0=PPMd
from __future__ import division | |
from numpy.fft import rfft | |
from numpy import argmax, mean, diff, log, nonzero | |
from scipy.signal import blackmanharris, correlate | |
from time import time | |
import sys | |
try: | |
import soundfile as sf | |
except ImportError: | |
from scikits.audiolab import flacread |
<!DOCTYPE HTML> | |
<head> | |
<title>Codesnippit NodeJS Twitter Tracker Client</title> | |
</head> | |
<body> | |
<ul></ul> | |
<script> | |
(function() { | |
var script = document.createElement("script"); | |
script.src = "http://code.jquery.com/jquery.min.js"; |
=begin | |
Capistrano deployment email notifier for Rails 3 | |
Do you need to send email notifications after application deployments? | |
Christopher Sexton developed a Simple Capistrano email notifier for rails. You can find details at http://www.codeography.com/2010/03/24/simple-capistrano-email-notifier-for-rails.html. | |
Here is Rails 3 port of the notifier. | |
The notifier sends an email after application deployment has been completed. |
#registrations_controller.rb | |
class RegistrationsController < Devise::RegistrationsController | |
def create | |
params[:user][:password_confirmation] = params[:user][:password] | |
super | |
end | |
end | |
<!-- Inside any View ---> | |
<%= form_for(:user, :url => "#", :html => { :id => "ajax_signup"}) do |f| %> |
find . -type f -print0 | xargs -0 sed -i 's/oldword/newword/g' |
#Get datetime for the beginning of the next month in the timezone that's currently set. | |
one_month_ahead = Time.zone.now.at_beginning_of_month.next_month | |
#You can format the datetime the way you want as well. | |
one_month_ahead = Time.zone.now.at_beginning_of_month.next_month.strftime("%Y-%m-%d %T %z") |
Model.columns.map {|c| puts "field :#{c.name}"} |
# app/models/ability.rb | |
# All front end users are authorized using this class | |
class Ability | |
include CanCan::Ability | |
def initialize(user) | |
user ||= User.new | |
can :read, :all |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Basic HTML5 Template</title> | |
<link href="stylesheets/style.css" rel="stylesheet" type="text/css" media="screen" /> | |
<script src="example.js"></script> | |
</head> | |
<body> |
#Dump and Restore MySQL DB Quick Ref
##Dump The MySQL Table
mysqldump -u username -p -r my_output.sql my_database
##Compress Output with 7zip using the PPMd Algorithm
7z a -t7z my_output.7z my_output.sql -m0=PPMd