View gist:bba01162a835abbc8a93
$('#form').on('submit', function(e) { | |
// stopp formet i å bli submitted | |
e.preventDefault(); | |
// en referanse til form-taggen | |
var $form = $(this); | |
// lag et options-objekt som gir info til $.ajax etterpå | |
var opts = { | |
url: 'kontakt.php', // send ajax-request til denne filen |
View gist:fe20586bebcdb3635292
<?php | |
$to = "hpn_x@hotmail.com"; // this is your Email address | |
$from = $_POST['mailInput']; // this is the sender's Email address | |
$name = $_POST['nameInput']; | |
$subject = "forespørsel til Livs Lekestue"; | |
$message = $name . " " . " wrote the following:" . "\n\n" . $_POST['messageInput']; | |
$headers = "From:" . $from; | |
$responseCode = 200; // regner med at alt går bra | |
if(!mail($to,$subject,$message,$headers)) { // mail-metoden returnerer true eller false avhengig av om mailen ble sendt |
View gist:aa2ee544a5e6b28ccab3
[include] | |
path = ~/.gitconfig-user | |
# Include user specific information | |
[core] | |
editor = vim | |
excludesfile = /opt/boxen/config/git/gitignore | |
autocrlf = input | |
# Convert line endings to platform input (LF on *nix, CRLF on windows). | |
# In other words, don't use this on windows. Use 'true' instead. |
View styles.scss
@mixin vh($heightPercentage) { | |
/** | |
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units | |
* | |
* To overcome this, create media queries that target the width, height, and orientation of iOS devices. | |
* It isn't optimal, but there is really no other way to solve the problem. | |
* | |
* iOS Resolution Quick Reference: http://www.iosres.com/ | |
* | |
* Original gist at from here: https://gist.github.com/pburtchaell/e702f441ba9b3f76f587 |
View dataset-es2015-polyfill.js
/* | |
@name HTML 5 dataset Support | |
@version 0.0.2 | |
@home http://code.eligrey.com/html5/dataset/ | |
@author Elijah Grey - eligrey.com | |
@license http://www.gnu.org/licenses/lgpl.html | |
Rewritten to ES2015 by Kristofer Selbekk | |
*/ | |
Element.prototype.setDataAttribute = function(name, value) { |
View qs-simple.js
export function parse(input) { | |
if (!input || typeof input !== 'string') { | |
return input; | |
} | |
const qs = input.startsWith('?') ? input.substring(1) : input; | |
return qs.split('&') | |
.filter(item => item) | |
.reduce((prev, item) => { |
View withDependencies.js
import React from 'react'; | |
export default withDependencies(TargetComponent, dependencies) { | |
return function DependencyInjector(props) { | |
return <TargetComponent {...props} {...dependencies} />; | |
} | |
} |
View withSpinner.jsx
// Her er en enkel spinner - en div med no css på | |
const Spinner = () => ( | |
<div className="spinner" /> | |
); | |
// Her er en liste med todos - den rendrer ut listen med todos. | |
const TodoList = props => ( | |
<ul classList="todos"> | |
{props.todos.map(todo => <li className="todo" key={todo.id}>{todo.text}</li>)} | |
</ul> |
View table.jsx
const Table = props => ( | |
<table> | |
<thead> | |
<tr> | |
{props.headers.map(header => <th>{header}</th>)} | |
</tr> | |
</thead> | |
<tbody> | |
{props.data.map(row => ( | |
<tr> |
View showcase.jsx
import React, { Component, PropTypes } from 'react'; | |
import { connect } from 'react-redux'; | |
import classNames from 'classnames'; | |
import EventImage from '~/components/EventImage'; | |
import Logo from '~/components/Logo'; | |
import Spinner from '~/components/Spinner'; | |
import * as dispatchers from '~/dispatchers'; |
OlderNewer