Skip to content

Instantly share code, notes, and snippets.

View minch's full-sized avatar

Adam Weller minch

View GitHub Profile
@mashingan
mashingan / sqlite3gorm.go
Last active August 20, 2023 16:04
Simple CRUD example working with Gorm
package main
import (
"fmt"
"net/http"
"strconv"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"github.com/labstack/echo"
@tanaikech
tanaikech / submit.md
Last active April 15, 2021 01:28
Copying Values from JSON to Struct using reflect Package for Golang

Copying Values from JSON to Struct using reflect Package

This is a sample script for copying values from JSON to a struct using reflect package.

Script :

package main

import (
	"encoding/json"
	"fmt"
Ruby 2.1.0 in Production: known bugs and patches
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production.
While testing the new build for rollout, we ran into a number of bugs. Most of
these have been fixed on trunk already, but I've documented them below to help
anyone else who might be testing ruby 2.1 in production.
@naruse I think we should backport these patches to the ruby_2_1 branch and
release 2.1.1 sooner rather than later, as some of the bugs are quite critical.
I'm happy to offer any assistance I can to expedite this process.
$VERBOSE = nil
require File.expand_path('../rooby', __FILE__)
Person = Rooby::Class.new 'Person' do
define :initialize do |name|
@name = name
end
define :name do
@LeaVerou
LeaVerou / dabblet.css
Created April 22, 2012 09:19 — forked from kizu/dabblet.css
Scrolling shadows by @kizmarh and @LeaVerou
/**
* Scrolling shadows by @kizmarh and @leaverou
* Only works in browsers supporting background-attachment: local; & CSS gradients
* Degrades gracefully
*/
html {
background: white;
font: 120% sans-serif;
}
@Calvein
Calvein / Custom.css
Created March 23, 2012 20:24
Solarized Dark Skin for the Chrome DevTools
body#-webkit-web-inspector #main{background-color:#002b36!important}body#-webkit-web-inspector #main .panel.network,body#-webkit-web-inspector #main .panel.timeline,body#-webkit-web-inspector #main .panel.profiles,body#-webkit-web-inspector #main .panel.audits,body#-webkit-web-inspector #main .panel.extension{background-color:#fff!important}body#-webkit-web-inspector #console-messages a:hover,body#-webkit-web-inspector #console-messages .console-formatted-function,body#-webkit-web-inspector #console-messages .console-formatted-object{color:#93a1a1!important}body#-webkit-web-inspector #console-prompt,body#-webkit-web-inspector #console-messages a,body#-webkit-web-inspector #console-messages .console-message,body#-webkit-web-inspector #console-messages .console-group-messages .section .header .title{color:#839496!important}body#-webkit-web-inspector #console-messages .console-formatted-null,body#-webkit-web-inspector #console-messages .console-formatted-undefined{color:#657b83!important}body#-webkit-web-inspect
@lrvick
lrvick / bitcolor.js
Created March 18, 2012 20:02
Javascript functions for doing fast binary/hex/RGB color conversions using bitwise operations.
// convert 0..255 R,G,B values to binary string
RGBToBin = function(r,g,b){
var bin = r << 16 | g << 8 | b;
return (function(h){
return new Array(25-h.length).join("0")+h
})(bin.toString(2))
}
// convert 0..255 R,G,B values to a hexidecimal color string
RGBToHex = function(r,g,b){
@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
@obie
obie / gist:1886393
Created February 22, 2012 18:08
Example of using an anonymous class to build an RSpec custom Matcher
def be_guest_member_of(expected)
Class.new do
def initialize(expected)
@expected = expected
end
def matches?(target)
@target = target
@target.memberships.where(role: "guest").map(&:network).include? @expected
end
module DonorsChoose
extend self
attr_accessor :api_key
def projects_near_me(latitude, longitude)
Request.get(:centerLat => latitude, :centerLong => longitude)
end
def projects_by_zip(zipcode)
Request.get(:keyword => zipcode)