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
require 'action_dispatch/routing' | |
require 'json' | |
routes = ::ActionDispatch::Routing::RouteSet.new | |
routes.draw do | |
namespace :admin do | |
resources :users | |
end | |
resources :ducks do | |
member do |
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
// A means of using underscore.js to do templates with conditionals | |
// Inside of underscore's template, it returns a function that uses | |
// 'with' on a variable named obj, and you can touch into that using | |
// inline JS and <% %> wrappers | |
// A template with conditional display of last names: | |
var good = _.template("Hello: <%= name %> <% if (obj.lastname) { %> <%= lastname %> <% } %>"); | |
// A template that tries to do that, but fails: | |
var bad = _.template("Hello: <%= name %> <% if (lastname) { %> <%= lastname %> <% } %>"); |
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
// Any copyright is dedicated to the Public Domain. | |
// http://creativecommons.org/publicdomain/zero/1.0/ | |
process.on('message', function(msg) { | |
console.log('reply'); | |
process.send(msg); | |
}); | |
process.ref(); |
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
require 'rubygems' | |
require 'nokogiri' | |
require 'fileutils' | |
require 'date' | |
require 'uri' | |
# usage: ruby import.rb my-blog.xml | |
# my-blog.xml is a file from Settings -> Basic -> Export in blogger. | |
data = File.read ARGV[0] |
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
... | |
# Fake a fuse install | |
RUN apt-get install libfuse2 | |
RUN cd /tmp ; apt-get download fuse | |
RUN cd /tmp ; dpkg-deb -x fuse_* . | |
RUN cd /tmp ; dpkg-deb -e fuse_* | |
RUN cd /tmp ; rm fuse_*.deb | |
RUN cd /tmp ; echo -en '#!/bin/bash\nexit 0\n' > DEBIAN/postinst | |
RUN cd /tmp ; dpkg-deb -b . /fuse.deb |
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
/* | |
* GINISS and THEILT Copyright 2018- Paul Brewer, Economic and Financial Technology Consulting LLC <drpaulbrewer@eaftc.com> | |
* This file may be used or copied under the terms of the MIT License as explained below or at https://opensource.org/licenses/MIT | |
* The MIT License | |
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | |
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | |
* to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | |
* Software. |
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
# get some ideas from https://github.com/zkat/genfun, https://www.npmjs.com/package/protoduck, and https://www.npmjs.com/package/@zkat/protocols | |
module X | |
module Generic | |
Any = BasicObject | |
DefaultArgs = [Any] | |
def define_generic_method(name, *args, &blk) | |
if args.empty? | |
raise TypeError, "Useless use of a generic method, you should have some arguments, otherwise a normal method is preferrable" | |
end |
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
#!/bin/sh | |
name="$1" | |
shift | |
PATHS="org.mpris.MediaPlayer2.$name /org/mpris/MediaPlayer2" | |
DBUS_SEND="dbus-send --type=method_call --dest=$PATHS" | |
RC="$DBUS_SEND org.mpris.MediaPlayer2.Player" | |
if [ "$@" = "prev" ]; then | |
$RC.Previous | |
elif [ "$@" = "stop" ]; then | |
$RC.Pause |
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
(defn heredoc [] | |
(let [delim (.readLine *in*)] | |
(->> (repeatedly #(.readLine *in*)) | |
(take-while #(not= delim %)) | |
(interpose \newline) | |
(apply str)))) | |
; The following lines are read (by the reader) as: | |
; "Look )(\"\\T\na here doc!\n" | |
#=(heredoc)""" |
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
#!/usr/bin/env ruby | |
# Libraries::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
require 'rubygems' | |
require 'sinatra/base' | |
require 'slim' | |
require 'sass' | |
require 'coffee-script' | |
# Application::::::::::::::::::::::::::::::::::::::::::::::::::: |
OlderNewer