Skip to content

Instantly share code, notes, and snippets.

View delonnewman's full-sized avatar

Delon R. Newman delonnewman

View GitHub Profile
if (__DEV__) {
window.devtoolsFormatters = window.devtoolsFormatters || [];
window.devtoolsFormatters.push((function() {
/* mori's type check methods */
var checks = [
'isReduceable', 'isSeqable',
'isReversible', 'isCounted', 'isIndexed',
(ns demo.gemstoclojure
(:use ring.adapter.jetty)
(:use clojure.contrib.io)
(:use clojure.contrib.classpath))
(import '(org.jruby.embed ScriptingContainer LocalContextScope))
(def c (ScriptingContainer. LocalContextScope/THREADSAFE))
(println (classpath))
(println (pwd))
<?php
require_once(dirname(__FILE__) . "/phpFlickr/phpFlickr.php");
require_once(dirname(__FILE__) . "/config.inc.php");
define("API_KEY", $config['flickr_api_key']);
define("USER_ID", $config['user_id']);
define("FLICKR_PHOTO_URL", "http://www.flickr.com/photos");
define("FLICKR_STATIC_URL", "http://farm5.static.flickr.com");
define("PRIMARY_PHOTO_CACHE", $config['primary_photo_cache']);
#
# = Pickr - A Gallery tool for Photographers
# These classes represent are an abstration away from the Flickr API.
# They provide methods for creating a gallery of photos for selecting
# and submitting to the photographer.
#
import yaml
import json
import flickrapi
#
# = Pickr - A Gallery tool for Photographers
# These classes represent are an abstration away from the Flickr API.
# They provide methods for creating a gallery of photos for selecting
# and submitting to the photographer.
#
require 'rubygems'
require 'flickraw-cached'
require 'yaml'
@nelhage
nelhage / make_yaml_safe.rb
Last active December 10, 2015 23:08
Neuter YAML to help mitigate CVE-2013-0156-style attacks.
# The fact that YAML.load will instantiate arbitrary ruby objects
# means that calling `YAML.load` on untrusted data is virtually always
# equivalent to executing arbitrary code in a complex app.
# This code fragment globally neuters YAML to disable this behavior,
# which should (hopefully) cut off all such attacks from the start.
# I don't promise this closes all possible attacks, but this closes
# off the trivial case. You should audit and upgrade all your
# dependencies, as well.
grammar Namespace {
token TOP { <ns-form>
# <clojure-forms>
}
# token clojure-forms { }
token ns-form { <.ws>?
(<.comment-line> <ws>?)*
<.ws>?
@creaktive
creaktive / yada-crawler.pl
Last active May 7, 2021 10:24
Simple web crawler/scraper implemented using Web::Scraper & YADA
#!/usr/bin/env perl
use 5.016;
use common::sense;
use utf8::all;
# Use fast binary libraries
use EV;
use Web::Scraper::LibXML;
use YADA 0.039;
require 'stringio'
require 'erb'
class Event
end
class MorphList
include Enumerable
def self.empty
@alabamenhu
alabamenhu / Grammar proposal.md
Last active November 21, 2021 15:32
Grammar proposal

This is designed to be a working proposal. Comments/corrections/suggestions are welcome, as the first draft was written fairly hastily. I'm working on doing a rough implementation to play around with, beginning with the Binex proposal, which can be found here. It is not currently a full implementation of this proposal, but progressing rapidly.

Background

Grammars in Raku are awesome, and allow for some truly amazing text parsing.
Unfortunately, they are less than ideal for binary files, and there is no way to have them support matching objects, both of which would be very useful (image being able to pattern match on an AST!) This requires writing complex and/or error prone workaround code.

Goal