Skip to content

Instantly share code, notes, and snippets.

View kisai's full-sized avatar

Sergio Diaz kisai

  • UNOSQUARE
  • Mexico
View GitHub Profile
@kisai
kisai / github-window-fit.css
Created March 3, 2019 20:41
CSS for stylus extension to make Github fit smaller windows
@-moz-document domain("githubusercontent.com"), domain("graphql-explorer.githubapp.com"), regexp("^https?://((blog|gist|guides|help|raw|resources|status|developer)\\.)?github\\.com/((?!generated_pages/preview).)*$") {
body {
min-width: auto !important;
}
.container {
transition: width 0.2s;
}
.container {

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@kisai
kisai / hangman.hs
Created October 7, 2015 01:57 — forked from ToJans/hangman.hs
A haskell implementation of the hangman game
import Control.Monad (when)
import Data.Char (toLower)
import Data.List (transpose)
import System.Random (randomIO)
wordsPath :: FilePath
wordsPath = "words.txt"-- "/usr/share/dict/words"
data GameState = GameState
{ _wordToGuess :: String
@kisai
kisai / mac.bash
Created August 27, 2015 17:59
Remove annoying mac bouncing of icons
defaults write com.apple.dock no-bouncing -bool TRUE
killall Dock
@kisai
kisai / hiccup-style.clj
Created December 9, 2014 19:20
Extend hiccup syntax for css style attribute
;; taken from http://stackoverflow.com/questions/12679754/idiomatic-way-of-rendering-style-info-using-clojure-hiccup
(defn style [& info]
{:style (.trim (apply str (map #(let [[kwd val] %]
(str (name kwd) " " val "; "))
(apply hash-map info))))})
@kisai
kisai / singleton_method.rb
Created September 18, 2014 23:55
Define a singleton method for a ruby object
class A
class << self
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
@kisai
kisai / convert_object_to_hash.rb
Created September 12, 2014 18:47
Convert object to hash in ruby
class Gift
def initialize
@name = "book"
@price = 15.95
end
end
gift = Gift.new
hash = {}
gift.instance_variables.each {|var| hash[var.to_s.delete("@")] = gift.instance_variable_get(var) }
#source http://stackoverflow.com/questions/5167829/how-can-i-pass-a-parameter-for-gem-installation-when-i-run-bundle-install
bundle config build.pg --with-pg-config=/path/to/pg_config
#source: http://skim.la/2012/01/16/rsa-public-key-interoperability-between-ruby-and-android/
require 'openssl'
require 'base64'
rsa = OpenSSL::PKey::RSA.new(2048)
modulus = rsa.n
exponent = rsa.e
oid = OpenSSL::ASN1::ObjectId.new("rsaEncryption")
alg_id = OpenSSL::ASN1::Sequence.new([oid, OpenSSL::ASN1::Null.new(nil)])
RUBY_PLATFORM