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
# Color escapes | |
RESET="\e[0m" | |
RED="\e[31m" | |
GREEN="\e[32m" | |
YELLOW="\e[33m" | |
LOGFILE_DIR="$HOME" | |
DATETIME=`date "+%m_%d_%Y_%H.%M.%S"` | |
LOGFILE="$LOGFILE_DIR/build_$DATETIME.log" | |
touch $LOGFILE |
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
# Automatically print tasks description wrapping the execution of | |
# the task. | |
module Capistrano::Configuration::Namespaces | |
alias_method :_task, :task | |
def task(name, options = {}, &block) | |
desc = next_description | |
full_task_name = [fully_qualified_name, name].compact.join(':') | |
$column = 0 | |
$last_was_after = 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
data = File.read('classes.txt') | |
classes = data.split(/^$\n/) | |
classes.each do |klass| | |
name, *methods = klass.split(/:?\n/) | |
Object.const_set(name, Class.new do | |
methods.each do |method| | |
parse = method.match(/(?<name>\w+) \(?(?<arguments>[\w\, ]*)\)? ?-> {(?<body>.*)}/) | |
if parse[:arguments].empty? | |
define_method(parse[:name]) { eval parse[:body] } | |
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
body{-webkit-animation: spin 30s linear infinite;} | |
p:before {content: "Code in Ruby! ";} | |
body, p, body p, body div p {font-family: 'Comic Sans MS', cursive !important;} | |
html {-webkit-animation: rainbow 8s infinite;} | |
@-webkit-keyframes blur { | |
0% { -webkit-filter: blur(0px); } | |
49% { -webkit-filter: blur(0px); } | |
50% { -webkit-filter: blur(1px); } | |
51% { -webkit-filter: blur(0px); } | |
100% { -webkit-filter: blur(0px); } |
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
module AliasMethodizer | |
private | |
def alias_method(alias_name, name, &function) | |
define_method alias_name, -> (*args, &block) do | |
value = method(name)[*args, &block] | |
instance_exec &function if block_given? | |
value | |
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
void mempack(void **restrict dst, const void *restrict src, size_t n) { | |
memcpy(*dst, src, n); | |
*dst = (char *) *dst + n; | |
} |
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
#include <fcntl.h> | |
#include <sys/types.h> | |
#include <sys/uio.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int roll_dice(int, int); | |
int main(int argc, char const *argv[]) { |
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
#include <windows.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
int main(int argc, char const **argv) { |
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
use std::marker::PhantomData; | |
use std::iter::Peekable; | |
use std::io::{Read, Bytes}; | |
use serde::Deserialize; | |
use serde_json as json; | |
use serde_json::error::Error as JsonError; | |
/// Iterator over parsed Messages. | |
pub struct DeserializeIter<T: Deserialize, R: Read> { | |
bytes: Peekable<Bytes<R>>, |
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
#[derive(Debug)] | |
struct Recur(u32); | |
impl Recur { | |
pub fn call(n: u32) -> u32 { | |
let r = Recur(n); | |
let r = r.recur(); | |
r.0 | |
} | |