Skip to content

Instantly share code, notes, and snippets.

View silveur's full-sized avatar

Silvere Letellier silveur

View GitHub Profile
@silveur
silveur / editlisting.js
Last active January 11, 2021 10:00
Updating a CG listing
const editListing = async ({ config, user, options = {} }) => {
const configRef = config._id;
const listingRef = options._id;
const item = await Item.findOne({ configRef, "listings._id": listingRef }).exec();
if (!item) throw new Error("Item not found");
const listing = item.listings.find(l => l._id.equals(listingRef));
if (!listing.id) listing.id = new Date().getTime();
const Navbar = (props) => {
const isMobile = useIsMobile();
if(isMobile) return <Mobile />
else return <DesktopNav />
}
const DesktopNav = (props) => {
return <navbar className="desktop" />
}
@silveur
silveur / deploy.sh
Created December 7, 2017 00:45
Deploy script from post-receive with nvm
#!/bin/bash
set -u
set -e
export NVM_DIR="$HOME/.nvm"
. "$NVM_DIR/nvm.sh"
target_branch="master"
working_tree=""
<script src="http://widget.mixcloud.com/media/js/widgetApi.js" type="text/javascript"></script>
<iframe id="mixcloudPlayer" width="100%" height="120" frameborder="0" src="https://www.mixcloud.com/widget/iframe/?feed=https%3A%2F%2Fwww.mixcloud.com%2Fspartacus%2Fparty-time%2F&hide_cover=1&light=1"></iframe>
<script type="text/javascript">
var widget = Mixcloud.PlayerWidget(document.getElementById('mixcloudPlayer'));
widget.getPosition().then(function(position) {
});
</script>