This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example take from the book Java Application Design (http://www.bevacqua.io/buildfirst) | |
// https://github.com/buildfirst/buildfirst/blob/master/ch05/06_prototypal-modularity/protolib.js | |
// Still using an IIFE to expose the library! | |
(function(window){ | |
// use these to sign each instance and access its private scope | |
var lastId = 0; | |
var data = {}; | |
function Lib () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired (stolen?) from JQuery (https://github.com/jquery/jquery/blob/1.3.2/src/ajax.js#L264) | |
// and http://www.nczonline.net/blog/2009/07/28/the-best-way-to-load-external-javascript/ | |
function loadJS(url, callback){ | |
var head = document.getElementsByTagName("head")[0]; | |
var script = document.createElement("script"); | |
script.src = url; | |
script.async = true; | |
// Attach handlers for all browsers | |
script.onload = script.onreadystatechange = function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
(function(e,t,n){var r,a,c="script";e.gigwell=e.gigwell||{},r=t.createElement(c), | |
a=t.getElementsByTagName(c)[0],r.async=1,r.src=n,a.parentNode.insertBefore(r,a) | |
})(window,document,'https://static.bookongigwell.com/booking-widget.min.js'); | |
gigwell.agencyId = 'x81998c8j812'; // Required | |
gigwell.artistId = '821x988122d'; // Optional | |
// optional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/opt/mxhero-apps/footers-web/shared/log/*.log { | |
daily | |
missingok | |
rotate 52 | |
compress | |
delaycompress | |
notifempty | |
create 0640 ubuntu ubuntu | |
sharedscripts | |
postrotate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pv ubuntu-14.10-desktop-amd64.img.dmg | sudo dd of=/dev/rdisk3 bs=1m | |
pv ~/Desktop/linuxmint.iso | sudo dd of=/dev/sdx oflag=direct bs=1048576 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title></title> | |
<script type="text/javascript" src="js/tinymce/tinymce.min.js"></script> | |
<script type="text/javascript"> | |
tinymce.init({ | |
selector: "textarea" | |
}); | |
function getRichContent(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1 id="qunit-header">Unit Tests</h1> | |
<h2 id="qunit-banner"></h2> | |
<div id="qunit-testrunner-toolbar"></div> | |
<ol id="qunit-tests"></ol> | |
<div id="qunit-fixture"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# instead of: class User < Struct.new(:first, :last) ... end | |
User = Struct.new(:first, :last) do | |
def full | |
"#{first} #{last}" | |
end | |
end | |
james = User.new('James', 'Gray') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Module | |
def method_added(name) | |
unless @_admin_only.nil? or @_proxy_method | |
@_proxy_method = true | |
alias_method "_admin_#{name}", name | |
module_eval <<-STRING | |
def #{name}(*args, &block) | |
_admin_#{name}(*args, &block) if admin? | |
end | |
STRING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dear Rubysts: | |
Did you know that Ruby can even read your emails? | |
#!/usr/bin/env ruby -w | |
puts "It's true." | |
__END__ |