Skip to content

Instantly share code, notes, and snippets.

import { redirect } from 'next/navigation'
async function fetchPage(slug) {
const res = await fetch('https://...')
if (!res.ok) return undefined
return res.json()
}
export default async function CampaignPage({ slug }) {
@osahyoun
osahyoun / redirect.html
Created February 8, 2018 09:08
redirect.html
<script>
// Array of tweets
var tweets = ["Tweet 1","Tweet 2","Tweet 3"];
var url = "https://twitter.com/intent/tweet?text=";
var tweet = tweets[Math.floor(Math.random() * tweets.length)];
var content = encodeURIComponent(tweet);
window.location.href = url + content;
@osahyoun
osahyoun / something.js
Last active November 21, 2017 18:42
blah
function() {
console.log('something');
}
@osahyoun
osahyoun / component.jsx
Last active May 28, 2017 11:55
testing syntax highlighting
const foo = () => {
return(
<Foo name='hello'>
<p>blah</p>
</Foo>
)
}
@osahyoun
osahyoun / instagram-feed.html
Last active August 20, 2016 09:57
Display Your Instagram Feed With 14 Lines of Code
<html>
<body>
<!--This requires a bitsalad URL (www.bitsalad.co) for your instagram feed, and append ?callback=_i to the URL.-->
<div id='instagram-feed'></div>
<script>
(function(a,b,c,d){
var $ = b.getElementById('instagram-feed');
a['_i'] = function(d){
echo "* Updating system"
apt-get update
apt-get -y upgrade
echo "* Installing packages"
apt-get -y install build-essential libxml2-dev libxslt1-dev git-core nginx redis-server curl nodejs htop
id -u deploy &> /dev/null
if [ $? -ne 0 ]
then
@osahyoun
osahyoun / dabblet.css
Created July 25, 2013 11:45
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
font-size: 14px;
color: white;
var thing; // thing has global scope now.
$(document).ready(function(){
thing = "AGGGFSDGS";}
});
@osahyoun
osahyoun / gist:5190802
Last active December 15, 2015 02:59
Tiny script for creating the backbone for a simple ruby app.
#! /bin/sh
# What is the name of the app?
NAME=$1
# Make directory structure
mkdir -p $NAME/{lib/$NAME,spec/lib/$NAME}
cd $NAME
@osahyoun
osahyoun / LICENSE.txt
Created August 24, 2012 09:16 — forked from eliperelman/LICENSE.txt
String.prototype.trim polyfill for 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Eli Perelman http://eliperelman.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE