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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
var counter int = 0 | |
var goroutines int = 500000 |
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
From c89f4d9c261fd005258ac551f23dddc835ac719b Mon Sep 17 00:00:00 2001 | |
From: Enric Lluelles <enric@lluell.es> | |
Date: Sat, 6 Sep 2014 02:06:02 +0200 | |
Subject: [PATCH] Add user data as a provider param | |
--- | |
lib/vagrant-digitalocean/actions/create.rb | 3 ++- | |
lib/vagrant-digitalocean/config.rb | 3 +++ | |
2 files changed, 5 insertions(+), 1 deletion(-) |
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
" run command | |
" no stdin | |
" output displayed in "Press enter to continue" style | |
" current buffer untouched | |
:!uptime | |
" run command | |
" pipe range of text to command on stdin | |
" output replaces the range in the current buffer | |
:RANGE!grep foo |
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 hmacSHA256 | |
(memoize (fn [payload secret] | |
(let [mac (Mac/getInstance "HMACSHA256") | |
secretKey (SecretKeySpec. (.getBytes secret) (.getAlgorithm mac)) | |
byteResult (-> (doto mac | |
(.init secretKey)) | |
(.doFinal (.getBytes payload))) | |
stringResult (->> byteResult | |
(map #(format "%x" %)) | |
(apply str))] |
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 ['clojure.set]) | |
(def happy-numbers (set [1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94, 97, 100])) | |
(def not-happy-numbers (clojure.set/difference (set (range 1 100)) happy-numbers)) | |
(defn decompose-in-digits [n] | |
(map #(Character/digit % 10) (str n))) | |
(def square #(*' % %)) | |
(defn- happy? [n visited] |
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 diamond.core | |
(:require [clojure.string :refer [join]])) | |
(defn char-range [start end] | |
(map char (range (int start) (inc (int end))))) | |
(defn steps | |
[c] | |
(map str (char-range \A c))) |
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
class Lesson < ActiveRecord::Base | |
belongs_to :period | |
validates_presence_of :period_id | |
end | |
class Period < ActiveRecord::Base | |
has_many :lessons, :dependent=>:delete_all | |
validates_associated :lessons | |
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
if Rails.configuration.try(:sass) | |
Rails.application.config.middleware.delete(Sass::Plugin::Rack) | |
Rails.configuration.sass.tap do |config| | |
config.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets" | |
config.preferred_syntax = :sass | |
end | |
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
Views = { | |
render: function (name, locals) { | |
var tmpl = $("[name=" + name + "]").html(); | |
var locals = locals || {}; | |
return require("jade.js").compile(tmpl)(locals); | |
}, | |
replace: function (sel, name, locals) { | |
return sel.html(this.render(name, locals)); | |
} |
OlderNewer