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
<?php | |
function day_of_week($day, $month, $year = null, $limit = 20) { | |
$found_day = false; | |
$days = array(); | |
$time = mktime(0, 0, 1, $month, 1, ($year?$year:date('Y'))); | |
if(date('Y', $time) == $day) | |
$found_day = true; | |
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 python | |
import time | |
tick = 0 | |
while 1: | |
step = time.time() | |
diff = step - tick | |
if diff > 0.025: |
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 python | |
import time | |
tick = 0 | |
while 1: | |
step = time.time() | |
diff = step - tick | |
if diff > 0.025: |
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
<?php | |
class MCAPI { | |
// ..snip | |
function MCAPI($apikey, $secure=false) { | |
$this->secure = $secure; | |
$this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php"); | |
$this->api_key = $apikey; | |
} |
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
<?php | |
class Hash { | |
var $buckets = array(); | |
function put($key, $value) { | |
$this->buckets[$this->generate_hash($key)] = $value; | |
} | |
function get($key) { |
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
; I have a bunch of these "example"-type functions: | |
(defn example [a b c] (str a b c)) | |
; Imagine incoming calls which look like this: | |
(def testing '(example 2 3)) | |
; My naive first attempt. Prints the string "123" | |
(println (apply (partial (resolve (first testing)) 1) (rest testing))) | |
; So, I've pre-applied the first argument to the 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
(def connection {:host "127.0.0.1"}) | |
(defn query [conn query] | |
(str (:host conn) ":" query)) | |
(defn query-with-modifiers [conn query modifiers] | |
(str (:host conn) ":" query ":" modifiers)) | |
(defmacro with-connection | |
[conn & body] |
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
(ns httpjson.core | |
(:require [clj-http.client :as client])) | |
(defn create-db | |
[db] | |
(client/request {:as :json | |
:accept :json | |
:content-type :json | |
:method :put | |
:url (str "http://127.0.0.1:5984/" db) |
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
diff --git libcloud/compute/drivers/softlayer.py libcloud/compute/drivers/softlayer.py | |
index babc89c..92be797 100644 | |
--- libcloud/compute/drivers/softlayer.py | |
+++ libcloud/compute/drivers/softlayer.py | |
@@ -108,7 +108,8 @@ class SoftLayerResponse(XMLRPCResponse): | |
class SoftLayerConnection(XMLRPCConnection, ConnectionUserAndKey): | |
responseCls = SoftLayerResponse | |
- endpoint = '/xmlrpc/v3/' | |
+ base_url = 'https://api.softlayer.com' |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<jmeterTestPlan version="1.2" properties="2.3" jmeter="2.8 r1393162"> | |
<hashTree> | |
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="eventlet + multiprocessing" enabled="true"> | |
<stringProp name="TestPlan.comments"></stringProp> | |
<boolProp name="TestPlan.functional_mode">false</boolProp> | |
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp> | |
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | |
<collectionProp name="Arguments.arguments"/> | |
</elementProp> |
OlderNewer