Skip to content

Instantly share code, notes, and snippets.

@kasima
kasima / swiftui_cheat_sheet.md
Last active May 28, 2023 05:31
SwiftUI Styling Cheat Sheet

Styling Text

Text(talkModel.promptText)
    .font(.title)
    .padding()
    .frame(maxWidth: .infinity)
    .background(.ultraThinMaterial)
    .foregroundColor(Color(UIColor.label))
@kasima
kasima / convert_safetensors_to_ckpt.py
Created January 5, 2023 15:14
Convert safetensors to ckpt – not working
import argparse
import torch
from safetensors.torch import load_file
def save_checkpoint(weights, filename):
with open(filename, "wb") as f:
torch.save(weights, f)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
@kasima
kasima / solidity-0_4_18-osx-highsierra.md
Last active April 10, 2018 07:20
Building solidity 0.4.18 on Mac OS X 10.13 (High Sierra)

Building solidity 0.4.18 on Mac OS X 10.13 (High Sierra)

# check out [email protected]
git clone https://github.com/ethereum/solidity.git
cd solidity
git checkout v0.4.21

# install deps
./scripts/install_deps.sh

Keybase proof

I hereby claim:

  • I am kasima on github.
  • I am kasima (https://keybase.io/kasima) on keybase.
  • I have a public key whose fingerprint is AB4E 1E84 1C7A D4F1 A073 A085 494F A252 6107 D628

To claim this, I am signing this object:

@kasima
kasima / gist:7847711
Created December 7, 2013 19:52
Crappybot
int LEFT = A0;
int RIGHT = A1;
int SERVO_MAX = 180.0;
int x_max;
int y_max;
Servo lt_servo;
Servo rt_servo;
@kasima
kasima / nest.coffee
Created December 14, 2012 22:53
hubot, make it cozy
# Description:
# Control your nest thermostat.
#
# Commands:
# hubot how (warm|cold) is it - current temperature
# hubot it's warm - set the nest 1 degree Fahrenheit lower
# hubot it's cold - set the nest 1 degree Fahrenheit higher
# hubot nest status - current nest setting
# https://github.com/kasima/nesting
@kasima
kasima / currently.js
Created November 29, 2012 07:33
Meteor.Router with and without session params
Meteor.Router.add({
'/posts': 'posts',
'/posts/:id': function(id) {
Session.set('postId');
return 'post';
},
'/authors/:id': function(id) {
Session.set('authorId', id);
return 'author';
}
@kasima
kasima / gist:979259
Created May 18, 2011 18:57
Making your js testable
// From http://front-end-testing-talk.elabs.se/
// Seen at RailsConf 2011
// Typical jQuery
$('#whiskies li').each(function() {
var li = $(this);
var price = li.attr('data-price');
var addLink = $('<a class="add-to-cart" href="#">Add to cart</a>');
addLink.appendTo(li);
@kasima
kasima / gist:957582
Created May 5, 2011 18:21
Mongoid $or bug
class Parent
include Mongoid::Document
field :pants
field :shirts
embeds_many :children
end
class Child
include Mongoid::Document
@kasima
kasima / gist:941464
Created April 25, 2011 23:17
Mongo Office Hours
class DiagnosticReport
include Mongoid::Document
embeds_many :marker_values
end
class MarkerValue
include Mongoid::Document