Skip to content

Instantly share code, notes, and snippets.

@NeMO84
NeMO84 / namespace_test.rb
Created April 15, 2011 23:10
Test to see that expected behaviour occurs for other developers.
# Namespace test.
module A
class B
class C
end
end
end
module A
class D
ruby-1.9.2-p0 > sub_end.strftime("Ends on %m/%d/%Y at %I:%M%p")
NoMethodError: undefined method `strftime' for 1315186557:Fixnum
from (irb):12
from /.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.9/lib/rails/commands/console.rb:44:in `start'
from /.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.9/lib/rails/commands/console.rb:8:in `start'
from /.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.9/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
ruby-1.9.2-p0 > sub_end
=> 1315186557
@NeMO84
NeMO84 / country.js.haml
Created August 24, 2011 09:36
JQuery Sample
# Is the semantic specifier on the id or name attribute of the div?
# If id then
$('#semantic').html('<p><%= @country.abstract.value %></p><p><%= @country.comment.value%></p><p>Currency: <%@country.currency.value%></p><p>Population: <%=@country.population.value%></p><p>Capital: <%=@country.capital.value%></p>');
# If name then
$('.semantic').html('<p><%= @country.abstract.value %></p><p><%= @country.comment.value%></p><p>Currency: <%@country.currency.value%></p><p>Population: <%=@country.population.value%></p><p>Capital: <%=@country.capital.value%></p>');
@NeMO84
NeMO84 / api.rb
Created December 22, 2011 22:42
Module Include/Extend Goal
class API < Grape::API
version 'v1', :using => :header, :vendor => 'onescreen', :format => :json
get 'hello' do
{:hello => 'world'}
end
# include Behavior
@NeMO84
NeMO84 / gist:6196489
Created August 9, 2013 19:32
Sublime user settings
{
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme",
"font_size": 10,
"git_gutter_live_mode": false,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
"tab_size": 2,
--- r8101_n.c 2013-10-22 11:46:05.822536955 -0700
+++ r8101_n_new.c 2013-10-22 11:44:55.134534000 -0700
@@ -1904,6 +1904,9 @@
rtl8101_rx_hwaccel_skb(skb, tp->vlgrp, swab16(opts2 & 0xffff));
ret = 0;
}
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ if (opts2 & RxVlanTag)
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff));
#else
@NeMO84
NeMO84 / delicious_importer.rb
Last active August 29, 2015 14:07
A script to help you import exported bookmarks from delicious back into delicious. It can probably easily be tweaked to work with Safari, Chrome, Firefox HTML exports.
#!/bin/ruby
require 'www/delicious'
require 'nokogiri'
require 'cgi'
module WWW
class Delicious
class Post < Element
@NeMO84
NeMO84 / tables_collation_changer.sql
Last active August 29, 2015 14:10
Convert collation for multiple tables easily
# Original: http://stackoverflow.com/questions/10859966/how-to-convert-all-tables-in-database-to-one-collation
SELECT CONCAT("ALTER TABLE ", TABLE_NAME," COLLATE <COLLATION_VALUE>") AS ExecuteTheString
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA="<SCHEMA_NAME>"
AND TABLE_TYPE="BASE TABLE";
# Execute selected scripts.
{
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"font_options": "subpixel_antialias",
"font_size": 14,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage",
"Markdown"
InfluxSrv:
image: "tutum/influxdb:0.8.8"
ports:
- "8083:8083"
- "8086:8086"
expose:
- "8090"
- "8099"
environment:
- PRE_CREATE_DB=cadvisor