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
# Ruby’s “method missing” analog with ES6 proxies. | |
proxify = (object) -> | |
new Proxy object, get: (receiver, name) -> | |
object[name] ? object.methodMissing.bind object, name | |
object = proxify | |
a: 1, | |
b: 15, | |
c: -> | |
'called' |
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 -w | |
# pnginator.rb: pack a .js file into a PNG image with an HTML payload; | |
# when saved with an .html extension and opened in a browser, the HTML extracts and executes | |
# the javascript. | |
# Usage: ruby pnginator.rb input.js output.png.html | |
# By Gasman <http://matt.west.co.tt/> | |
# from an original idea by Daeken: http://daeken.com/superpacking-js-demos |
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
def extract_text | |
file = File.open("#{pdf.queued_for_write[:text].path}","r") | |
plain_text = "" | |
while (line = file.gets) | |
# plain_text << line.gsub(/[^\x00-\x7F]/n,'').gsub(/`/,"'").gsub(/^\d+$/,'').to_s + "\n" | |
plain_text << Iconv.conv('ASCII//IGNORE', 'UTF8', line) | |
end | |
self.plain_text = plain_text | |
#self.plain_text = Iconv.conv('ASCII//IGNORE', 'UTF8', file.read) | |
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 | |
### | |
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
### | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
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
Option Explicit | |
Function GetBrighterPlanetApiKey() | |
GetBrighterPlanetApiKey = ActiveWorkbook.Worksheets("Setup").Range("C2").Value | |
End Function | |
Function IsEmissionEstimateServiceOnline() | |
If LCase(ActiveWorkbook.Worksheets("Setup").Range("C3").Value) = "online" And ThisWorkbook.HasFinishedWorkbookOpen() = True Then | |
IsEmissionEstimateServiceOnline = True | |
Else |
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 | |
mkdir tmp | |
cd tmp | |
wget https://github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz | tar xzf - | |
cd libevent-2.0.20-stable | |
./configure --prefix=$HOME/local && make && make install | |
cd .. |