This file contains hidden or 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
| push = (element) -> (stack) -> | |
| newStack = [element].concat stack | |
| {value: element, stack: newStack} | |
| pop = (stack) -> | |
| element = stack[0] | |
| newStack = stack.slice 1 | |
| {value: element, stack: newStack} | |
| bind = (stackOperation, continuation) -> (stack) -> |
This file contains hidden or 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
| \* Build Lisp CxRS *\ | |
| \* CC Part *\ | |
| (defcc <expr> X <expr> := [X | <expr>]; <e> := [];) | |
| (defcc <a-d-to-head-tail> | |
| "a" <a-d-to-head-tail> := [head <a-d-to-head-tail>]; | |
| "d" <a-d-to-head-tail> := [tail <a-d-to-head-tail>]; | |
| "r" <expr> := <expr>;) | |
| (defcc <cxr?> | |
| "c" "a" <a-d-to-head-tail> := [head <a-d-to-head-tail>]; |
This file contains hidden or 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
| Meteor.subscribe( | |
| 'server_sessions', | |
| amplify.store('session'), // Read from local storage / cookies | |
| function() { | |
| // The server returns only one record, so findOne will return that record | |
| var serverSession = new Meteor.Collection('server_sessions').findOne(); | |
| // Stores into client session all data contained in server session; | |
| // supports reactivity when server changes the serverSession | |
| Session.set('serverSession', serverSession); | |
| // Stores the server session id into local storage / cookies |
This file contains hidden or 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
| if (Meteor.is_client) { | |
| var userName = "PatelNachiket"; | |
| Template.hello.greeting = function () { | |
| return "Fetch recent tweets from Twitter stream of user : " ; | |
| }; | |
| Template.hello.events = { | |
| 'click #fetchButton' : function () { | |
| console.log("Recent tweets from stream!"); | |
| $('#fetchButton').attr('disabled','true').val('loading...'); |
This file contains hidden or 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
| ;;; auto-rsync-mode -- minor mode for auto rsync | |
| ;; | |
| ;; Author: @l3msh0 | |
| ;; | |
| ;;; Example | |
| ;; | |
| ;; (require 'auto-rsync) | |
| ;; (auto-rsync-mode t) | |
| ;; (setq auto-rsync-dir-alist |
This file contains hidden or 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
| ;;;; Load some utilities | |
| ;;; ... typically this would go in our ASDF system file. | |
| ;;; in which case you wouldn't need the eval when | |
| (eval-when (:compile-toplevel :load-toplevel :execute) | |
| (ql:quickload "cl-interpol") | |
| (ql:quickload "named-readtables")) | |
| ;;;; Define a package and a read table. |
This file contains hidden or 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
| (ns my.server | |
| (:use org.httpkit.server | |
| [clojure.string :only [split trim lower-case]]) | |
| (:import [org.httpkit.server AsyncChannel])) | |
| (defn origin-match? [origin-re req] | |
| (if-let [req-origin (get-in req [:headers "origin"])] | |
| (re-matches origin-re req-origin))) |
This file contains hidden or 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 | |
| # Follows https://github.com/oortcloud/unofficial-meteor-faq#where-should-i-put-my-files | |
| # I release this into the Public domain -osirisx11 on freenode | |
| : <<'END' | |
| osiris@krypton:~/playpen$ ~/meteor-create.sh example | |
| example: created. | |
| To run your new app: | |
| cd example | |
| meteor |
This file contains hidden or 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
| import urllib2 | |
| import re | |
| import sys | |
| from collections import defaultdict | |
| from random import random | |
| """ | |
| PLEASE DO NOT RUN THIS QUOTED CODE FOR THE SAKE OF daemonology's SERVER, IT IS | |
| NOT MY SERVER AND I FEEL BAD FOR ABUSING IT. JUST GET THE RESULTS OF THE | |
| CRAWL HERE: http://pastebin.com/raw.php?i=nqpsnTtW AND SAVE THEM TO "archive.txt" |
This file contains hidden or 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
| ;; This fn allows calling any method, as long as it's the first with that name in getDeclaredMethods(). | |
| ;; Works even when the arguments are primitive types. | |
| (defn call-method | |
| [obj method-name & args] | |
| (let [m (first (filter (fn [x] (.. x getName (equals method-name))) | |
| (.. obj getClass getDeclaredMethods)))] | |
| (. m (setAccessible true)) | |
| (. m (invoke obj (into-array Object args))))) |
OlderNewer