Skip to content

Instantly share code, notes, and snippets.

@neaf
neaf / Usage
Last active November 8, 2015 17:40
Gets youtube video URL and exports mp3 file while asking for artist and title
~/Dev/ytdl ❯ ruby ytdl.rb https://www.youtube.com/watch\?v\=ftIBZNklEFU R: 2.2.2
[youtube] ftIBZNklEFU: Downloading webpage
[youtube] ftIBZNklEFU: Downloading video info webpage
[youtube] ftIBZNklEFU: Extracting video information
[youtube] ftIBZNklEFU: Downloading DASH manifest
[youtube] ftIBZNklEFU: Downloading DASH manifest
[download] Destination: Acid Interstate V1 - 2015 Remake-ftIBZNklEFU.m4a
[download] 100% of 3.33MiB in 00:01
[ffmpeg] Correcting container in "Acid Interstate V1 - 2015 Remake-ftIBZNklEFU.m4a"
[ffmpeg] Destination: Acid Interstate V1 - 2015 Remake-ftIBZNklEFU.mp3
@neaf
neaf / remove_columns.rb
Created May 31, 2013 10:38
Deploy this initializer before migrations involving dropping/changing names of columns
model = MyModel
column_names = %w{ first_column second_column }
columns = model.columns.select { |c| column_names.include?(c.name) }
columns.each do |c|
model.columns.delete(c)
end
@neaf
neaf / gist:2966031
Created June 21, 2012 14:25
Clean TweetDeck to display on screen
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url("https://web.tweetdeck.com/") {
#nav-column,
#topbar {
display: none !important;
}
#container {
top: -3px;
@neaf
neaf / gist:2415683
Created April 18, 2012 18:39
Port redirect with nginx
# Nginx config for redirecting traffic from port 80 to 8800
upstream app {
server localhost:8800 fail_timeout=60;
}
server {
listen 80;
client_max_body_size 100m;
server_name app.example.com;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
pry(main)> s = Emvoicer::Services::Blinksale.new("xteamtest", "xteam-api", "xteam-api")
=> #<Emvoicer::Services::Blinksale:0x00000102b070e0>
pry(main)> EM.run { s.invoices({:status => "open"}, proc { |invoices| puts invoices; EM.stop }) }
{:id=>2706951, :number=>"1", :total_amount=>1200.0, :due_amount=>1200.0, :issued_on=>#<Date: 2011-06-22 (4911469/2,0,2299161)>, :due_on=>#<Date: 2011-07-07 (4911499/2,0,2299161)>, :currency=>"USD"}
=> nil
pry(main)>
Start: ipsum
Start: dolor
Start: sit
Start: amet,
Start: consectetur
Start: adipiscing
Start: elit.
Start: Fusce
Start: pharetra
Start: ullamcorper
@neaf
neaf / gist:1016902
Created June 9, 2011 15:02
Simple JS tabs
<div class="tabs">
<ul class="tab-list">
<li><a href="#tab-1">Tab 1</a></li>
<li><a href="#tab-2">Tab 2</a></li>
<li><a href="#tab-3">Tab 3</a></li>
</ul> <!-- .tab-list -->
<div class="tab" id="tab-1"></div>
<div class="tab" id="tab-2"></div>
<div class="tab" id="tab-3"></div>
.
├── README
├── app.js
├── css
│   ├── main.styl
│   └── reset.styl
├── db.js
├── game
│   ├── game.js
│   └── state_machine.js
➜ zems git:(chat) cat package.json
{
"name": "zems",
"version": "0.0.1",
"dependencies": {
"cluster": "0.6.2",
"cluster-socket.io": "0.2.0",
"connect": "1.4.2",
"connect-mongo": "0.1.2",
"express": "2.3.10",