Skip to content

Instantly share code, notes, and snippets.

View gobijan's full-sized avatar
🏝️
Deep in the Caribbean...

Bijan Rahnema gobijan

🏝️
Deep in the Caribbean...
View GitHub Profile
<!-- HEADLESSUI DROPDOWN THOUGHT EXPERIMENT FOR A JS-ONLY CORE LIB -->
<div data-headlessui-dropdown>
<button class="..." type="button" data-headlessui-dropdown-toggle>
Dropdown button
</button>
<ul data-headlessui-dropdown-menu>
<li><a class="..." href="#">Action</a></li>
<li><a class="..." href="#">Another action</a></li>
<li><a class="..." href="#">Something else here</a></li>
@gobijan
gobijan / bootstrap-color-vars.css
Created June 7, 2022 20:36
Bootstrap 5 CSS Color Variables
:root {
--blue-100:#cfe2ff;
--blue-200:#9ec5fe;
--blue-300:#6ea8fe;
--blue-400:#3d8bfd;
--blue-500:#0d6efd;
--blue-600:#0a58ca;
--blue-700:#084298;
--blue-800:#052c65;
--blue-900:#031633;
@gobijan
gobijan / console.log
Created June 14, 2018 06:53
Rails 5.2 + Ruby 2.5.1 via rbenv warnings.
rails s 08:49:35
/Users/bijan/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:90: warning: already initialized constant FileUtils::VERSION
/Users/bijan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:92: warning: previous definition of VERSION was here
/Users/bijan/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:1188: warning: already initialized constant FileUtils::Entry_::S_IF_DOOR
/Users/bijan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1267: warning: previous definition of S_IF_DOOR was here
/Users/bijan/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:1446: warning: already initialized constant FileUtils::Entry_::DIRECTORY_TERM
/Users/bijan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1541: warning: previous definition of DIRECTORY_TERM was here
/Users/bijan/.rbenv/versions/2.5.1/lib/rub
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@gobijan
gobijan / controllers.application.js
Last active June 30, 2016 14:05
Guides Playground
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Component.extend({
name: 'Bijan'
});
// There seem to be problems with "climatically" and "fezzes" as passwords.
// When using "climatically": Program terminates with "openpgp: unsupported feature: public key version"
// When using "fezzes": Program terminates with "openpgp: invalid data: tag byte does not have MSB set"
// Expected behaviour would be a reinvokation of the prompt function in an endless loop until the right password is used.
package main
import (
"bytes"
"errors"
@gobijan
gobijan / gist:d724de27e2aff8131676
Created November 13, 2014 00:02
Convert NSColor to Hex
func getHexFromColor(color: NSColor) -> NSString {
// Get the red, green, and blue components of the color
var r :CGFloat = 0
var g: CGFloat = 0
var b: CGFloat = 0
var a: CGFloat = 0
var rInt, gInt, bInt, aInt: Int
var rHex, gHex, bHex: NSString
@gobijan
gobijan / gist:1568fb2b35c517f36369
Created July 15, 2014 11:27
Golang HTTP Handler to Upload Image => Resize => Convert to JPEG => Save to Disk.
func UploadHandler(w http.ResponseWriter, r *http.Request) {
file, _, err := r.FormFile("file")
if err != nil {
log.Println(err)
http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
return
}
img, _, err := image.Decode(file)