Skip to content

Instantly share code, notes, and snippets.

View Spaceghost's full-sized avatar
👻
Building distributed and decentralized systems that run in the browser

Johnneylee Jack Rollins Spaceghost

👻
Building distributed and decentralized systems that run in the browser
View GitHub Profile
@jo
jo / js-crypto-libraries.md
Last active March 31, 2024 20:33
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

List some crypto libraries for JavaScript out there. Might be a bit out dated. Scroll to the bottom.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

module PubSub
class << self
def create type, channel, object
channel = channel.to_sym
case type
when :listener
listeners[channel] ||= Array.new
listeners[channel] << object
channels[channel] ||= Array.new
@bsodmike
bsodmike / gist:4525870
Last active October 26, 2017 10:32
Differences Between Unit, Functional, and Integration Testing

The difference between those are that unit tests one object and one object only. Typically mocking anything else outside the SUT (System under test).

Integration tests a system of collaborators, or multiple objects that work in concert. Functional tests a system from the outside into the centre as a full stack test. User stories test interactions and outcomes.

The difference between functional and user stories is that a functional test exercises a system with a focus of "given this kind of input, I expect this output back" and user story is more focused on "When I perform this kind of thing, given the system is in this kind of state or has this data, I expect to see this kind of thing as a result."

Functional can also test the side-effects rather than just the input and output.

@davidcelis
davidcelis / zelda-battery.sh
Created December 18, 2012 00:28
Output a Zelda-style heart meter for your MacBook's battery level. On the command line. Based on an idea from @stephencelis, executed by myself. For a tmux version, see https://gist.github.com/4324139
#!/usr/bin/env zsh
#
# Works best with blinking text; the last heart will blink
# when you have less than 25% of your battery life remaining.
BATTERY="$(pmset -g ps | awk 'NR==2' | perl -pe 's/.*?(\d+)%.*/\1/')"
if [[ $BATTERY -lt 25 ]]; then
echo "\e[5;31m♥\e[0;31m♡♡\e[0m"
elif [[ $BATTERY -lt 50 ]]; then
@pengwynn
pengwynn / octocat_zen.sh
Created November 14, 2012 02:42
GitHub Zen
$ curl https://api.github.com/zen | octocatsay
MMM. .MMM
MMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMM ____________________________
MMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMM | Practicality beats purity. |
MMMMMMMMMMMMMMMMMMMMMMMM |_ ________________________|
MMMM::- -:::::::- -::MMMM |/
MM~:~ ~:::::~ ~:~MM
$VERBOSE = nil
require File.expand_path('../rooby', __FILE__)
Person = Rooby::Class.new 'Person' do
define :initialize do |name|
@name = name
end
define :name do
@tagrudev
tagrudev / yolo
Last active May 13, 2017 13:51
YOLO practices #RubyOnRails
# Do not refactor, it is a bad practice. YOLO
# Not understanding why or how something works is always good. YOLO
# Do not ever test your code yourself, just ask. YOLO
# No one is going to read your code, at any point don't comment. YOLO
# Why do it the easy way when you can reinvent the wheel? Future-proofing is for pussies. YOLO
###
# Scheme code is translated to YARV byte code, then evaluated in the
# Ruby Virtual Machine
require 'rbconfig'
require 'dl'
require 'fiddle'
require 'strscan'
class RubyVM
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@mpapis
mpapis / osx_rails_env_setup_in_1_step.md
Created March 30, 2012 04:54 — forked from solnic/osx_rails_env_setup_in_6_steps.md
One step to get up'n'running with Rails on OS X or Linux

Use this command and follow the instructions:

curl -L get.rvm.io | bash -s stable --rails

Other options include(any gems imply --ruby):

--ruby=1.9.3
--gems=rails,gist

Optionally on OSX install homebrew, use brew command to install whatever database engine you need, ie brew install sqlite