Skip to content

Instantly share code, notes, and snippets.

View harin's full-sized avatar
🎯
Focusing

Harin Sanghirun harin

🎯
Focusing
View GitHub Profile
@harin
harin / prune_mlflow_project_conda_env.sh
Created January 25, 2021 23:15
Prune MLFlow project's conda env
for s in $(conda env list | grep mlflow | awk '{ print $1}');
do
conda remove -y --all --name $s;
done
@harin
harin / .vimrc
Created October 23, 2019 22:48
bootstrap vimrc for python and js
" vim-bootstrap
"*****************************************************************************
"" Vim-PLug core
"*****************************************************************************
let vimplug_exists=expand('~/.vim/autoload/plug.vim')
let g:vim_bootstrap_langs = "javascript,python"
let g:vim_bootstrap_editor = "vim" " nvim or vim
Verifying my Blockstack ID is secured with the address 1Ehzs5BkVwcEqKZQffCqL7t84FToa2p4fB https://explorer.blockstack.org/address/1Ehzs5BkVwcEqKZQffCqL7t84FToa2p4fB
@harin
harin / README.md
Created November 19, 2015 06:56 — forked from wrburgess/README.md
How to add a custom calculator for shipping or taxes to Spree
  1. Add initializer to config/application.rb
  2. Add new class to app/models/spree/calculators/[class_name].rb
  3. Add logic to class file

Class must have the following methods:

def self.description
  "Custom FlexiRate"
end
@harin
harin / TabbedNavigationController.swift
Last active February 3, 2022 11:45
Custom NavigationController Subclass
//
// TabbedNavigationController.swift
// CustomerNavigationBar
//
// Created by Harin Sanghirun on 13/6/58.
// Copyright (c) พ.ศ. 2558 Harin Sanghirun. All rights reserved.
//
import UIKit
var switch_a = new five.Switch(8);
var switch_b = new five.Switch(9);
var is_on_a = false;
var is_on_b = false;
switch_a.on("open", function() {
is_on_a = true;
shouldDoStuff();
});
switch_a.on("close", function() {
@harin
harin / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
NSString *imageName = [NSString stringWithFormat:@"profile%i%i.jpg", self.no/10, self.no%10];
UIImage *image = [UIImage imageNamed:imageName];
UIImageView *profileImage = [[UIImageView alloc] initWithImage:image];
profileImage.frame = CGRectMake(0, 0, 55,55);
[profileImage setContentMode:UIViewContentModeScaleAspectFill];
// make new layer to contain shadow and masked image
CALayer* containerLayer = [CALayer layer];
containerLayer.shadowColor = [UIColor blackColor].CGColor;
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
# Pusher.log = (message) ->
# if window.console and window.console.log
# window.console.log(message);
`
Pusher.log = function(message) {
if (window.console && window.console.log) {
def new
@appointment = Appointment.new
if params[:booking_id] then
@booking = Booking.find_by(params[:booking_id])
@appointment.date = @booking.date
end
respond_to do |format|
format.html # new.html.erb
format.json { render json: @appointment }