Skip to content

Instantly share code, notes, and snippets.

@jlebrech
jlebrech / webpack.config.js
Created June 7, 2018 13:18
webpack 3.1, AngularJS 1.x config
var path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
config = {
entry: {
app: './app/scripts/main.js',
login: './app/scripts/login.js',
vendors: './app/scripts/vendors.js'
➜ go-gtk git:(master) make
cd pango && go build && go install github.com/mattn/go-gtk/pango
package .
imports runtime: cannot find package "runtime" in any of:
/usr/local/go/bin/src/pkg/runtime (from $GOROOT)
/Users/jlebrech/gocode/src/runtime (from $GOPATH)
package .
imports runtime/cgo: cannot find package "runtime/cgo" in any of:
/usr/local/go/bin/src/pkg/runtime/cgo (from $GOROOT)
/Users/jlebrech/gocode/src/runtime/cgo (from $GOPATH)
~ go get github.com/mattn/go-gtk/gtk
package github.com/mattn/go-gtk/gtk
imports fmt: unrecognized import path "fmt"
package github.com/mattn/go-gtk/gtk
imports runtime: unrecognized import path "runtime"
package github.com/mattn/go-gtk/gtk
imports runtime/cgo: unrecognized import path "runtime/cgo"
package github.com/mattn/go-gtk/gtk
imports unsafe: unrecognized import path "unsafe"
package github.com/mattn/go-gtk/gtk
{
"ignored_packages":
[
"Vintage"
],
"hot_exit": false,
"remember_open_files": false,
"save_on_focus_lost": true,
"tab_size": 2,
"translate_tabs_to_spaces": true
require 'digest/sha2'
module GoogleAuthoriseHelper
def google_auth_url(user_id)
encoded_id = encode_id_and_store(user.id)
end
def encode_id_and_store(user_id)
sha256 = Digest::SHA2.new(256)
require 'net/http'
require 'net/https'
require 'openssl'
file_path = File.expand_path(__FILE__)
path = File.dirname(file_path)
oauth_url = 'https://accounts.google.com/o/oauth2/auth'
url = URI.parse(oauth_url)
class Url < ActiveRecord::Base
def find_link(url)
link = link_finder(url)
EM::Run {
link.callback {
p "done"
}
}
end
end
@jlebrech
jlebrech / routes.rb
Created February 25, 2013 10:39
how to send "/:username" to "show/username" and nest favourites into "/username"
...
resources :users do # should map "/:username" to user_controller/show
resources :favourites do # should send /:username/favourites, to favourite_controller/index
resources :fruit, :cars, :sports, :foods
end
end
@jlebrech
jlebrech / _form.html.erb
Last active December 13, 2015 19:08
Nested resource with custom path
..
form_for [current_user,@thing]
..
# this creates the path
# /user/bob/things to post to
# but I would like the path
# /bob/things