Skip to content

Instantly share code, notes, and snippets.

View pyk's full-sized avatar
🐈‍⬛
I may be slow to respond.

pyk pyk

🐈‍⬛
I may be slow to respond.
View GitHub Profile

Ruby on Rails development setup on Ubuntu 12.04

System update

# change mirror to ubuntu.osuosl.org first
sudo apt-get update

Install common libraries

sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev

/**
* Generates JavaScript version of HTML templates for AngularJS as part of a Grunt build
*
* Allows for bundling into multiple collections, for applications that are distributed across more than one page.
*
* Usage (in grunt.initConfig):
*
* html2js: {
* firstTemplateCollection: {
* src: ['<%= src.first %>'],
@pyk
pyk / example.rb
Created December 18, 2013 07:28 — forked from britishtea/example.rb
require 'function'
# A fibonacci function.
fib = Function.new
fib[0] = 0
fib[1] = 1
fib[Integer] = proc { |i| fib[i - 2] + fib[i - 1] }
p fib[0] # => 0
@pyk
pyk / less_converter.rb
Last active January 2, 2016 18:49 — forked from KBalderson/less_converter.rb
Using LESS on Jekyll site . for using intructions see here https://kippt.com/bayu/notes/clips/18862841
module Jekyll
class LessConverter < Converter
safe true
priority :high
def setup
return if @setup
require 'less'
@setup = true
rescue LoadError
# generate using this gems : http://rubygems.org/gems/terminal-table
require "terminal-table"
title = "posts"
properties = ["id", "title", "author_name", "body"]
r = []
r << [1, "I love dogs", "John", "woof"]
r << [2, "cars are great", "Sara", "I think they are"]
@pyk
pyk / gist:8613205
Last active January 4, 2016 11:09 — forked from schneems/gist:3036609
## Week 3 Quiz
## 1) What does ERB stand for?
Embedded Ruby
## 2) What is the name of the place (library) where additional built in Ruby functions can be accessed?
STDlib
@pyk
pyk / note.sh
Created June 18, 2016 19:12
new way to install llvm libc++ in Ubuntu 14.04 Trusty
# http://llvm.org/apt/
sudo bash -c "cat >> /etc/apt/sources.list" << LLVMAPT
# LLVM
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main
deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty main
# 3.5
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.5 main
deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.5 main
# 3.6
@pyk
pyk / valid-email.lua
Created March 9, 2017 22:51 — forked from james2doyle/valid-email.lua
Lua validate email address
function validemail(str)
if str == nil then return nil end
if (type(str) ~= 'string') then
error("Expected string")
return nil
end
local lastAt = str:find("[^%@]+$")
local localPart = str:sub(1, (lastAt - 2)) -- Returns the substring before '@' symbol
local domainPart = str:sub(lastAt, #str) -- Returns the substring after '@' symbol
-- we werent able to split the email properly
@pyk
pyk / understanding-word-vectors.ipynb
Created March 2, 2018 14:13 — forked from aparrish/understanding-word-vectors.ipynb
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pyk
pyk / spirals.pde
Created March 14, 2018 09:04 — forked from beesandbombs/spirals.pde
spirals
// 'spirals' by dave
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {