Skip to content

Instantly share code, notes, and snippets.

<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@oslego
oslego / scrollTo.js
Last active September 22, 2015 10:32 — forked from james2doyle/scrollTo.js
a native scrollTo function in javascript that uses requestAnimationFrame and easing for animation
// easing functions http://goo.gl/5HLl8
Math.easeInOutQuad = function (t, b, c, d) {
t /= d/2;
if (t < 1) {
return c/2*t*t + b
}
t--;
return -c/2 * (t*(t-2) - 1) + b;
};
/*
I used your style, your header div, but with a slide like this
<section data-state="showHeader" data-header="custom head">
<p>Hello</p>
</section>
*/
Reveal.addEventListener( 'slidechanged', function( event ) {
@oslego
oslego / mkhost.sh
Created June 28, 2011 18:15
Create localhost website folder and add virtualhost
#!/bin/sh
# USE AT YOUR OWN RISK. Tested on Ubuntu 11.04 with apache2.
# CHECK COMMENTS BEFORE RUNNING
# this script creates localhost website folder and adds virtualhost
# website name - it will append .lh for the path
# ex.: 'example' will be accessed as example.lh in the browser
website="$@"
if [ -z "$website" ]; then
echo "No website, no fun."
@oslego
oslego / list.rb
Created January 4, 2012 16:05
Related Lists
class List < ActiveRecord::Base
has_many :related_lists, :finder_sql => 'SELECT * FROM related_lists WHERE list_a_id = #{id} OR list_b_id = #{id}'
end
@oslego
oslego / pr.md
Created June 11, 2016 12:50 — forked from bgrins/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@oslego
oslego / gist:f13e136ffeaa6174289a
Last active January 3, 2019 14:24 — forked from sl4m/gist:5091803
create self-signed certificate for localhost
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@oslego
oslego / hooks.js
Last active December 4, 2020 18:20 — forked from WebReflection/hooks.js
const augment = callback => () => {
const useState = {
init: true,
value: void 0,
update(value) {
useState.value = value;
callback(hooks)
}
};
const hooks = {