Skip to content

Instantly share code, notes, and snippets.

View stephanfoxwell's full-sized avatar

Stephan Foxwell stephanfoxwell

View GitHub Profile
var databasename = ''
var connection = indexedDB.open(databasename)
connection.onsuccess = async (e) => {
var database = e.target.result
var json = await exportToJson(database)
console.log(json)
}
@pablomayobre
pablomayobre / useAnimationFrame.js
Created March 2, 2020 20:38
useAnimationFrame React Hook, for requestAnimationFrame, with Delta Time and no re-rendering. Uses useLayoutEffect so it can be used before the canvas has been rendered to screen,
import { useState, useRef, useLayoutEffect } from "react";
const useAnimationFrame = (callback) => {
const callbackRef = useRef(callback);
const frameRef = useRef();
const timerRef = useRef();
useLayoutEffect(() => {
callbackRef.current = callback;
}, [callback]);
@mircian
mircian / gform_sections_accordion.css
Last active August 20, 2022 17:43
Transform Gravity Forms sections into an accordion with jQuery - https://mircian.com/2016/11/06/transform-gravity-forms-sections-accordion/
.m_collapse_text, .show_collapse .m_expand_text, .m_section{
display: none;
}
.show_collapse .m_collapse_text {
display: inline;
}
@antirek
antirek / README.md
Created January 31, 2016 12:17 — forked from debashisbarman/README.md
A Twitter bot that can retweet in response to the tweets matching particluar keyword (https://goo.gl/4whEIt)

#Creating a Twitter bot with Node.js Learn how you can create your own Twitter bot using Node.js and the new Twitter API. The bot will auto retweet in response to tweets with some particular hashtags. (https://goo.gl/4whEIt)

##Tools we need Here are the tools we’ll be using to create the bot — 

  • Node.js installed in your machine
  • A registered Twitter account

Create a Twitter application

@Shelob9
Shelob9 / josie-basic-object.js
Created November 10, 2014 00:45
Example layout for a WordPress REST API powered app script. Based on https://github.com/Shelob9/josie
/**globals jQuery Josie**/
jQuery( function () {
Josie.init();
} );
(function ( $, app ) {
app.init = function() {
app.menuItems( params.mainMenuName, params.mainMenuContainer );
$(document).on ("click", "[josie=internal]", function ( event ) {
@iksose
iksose / restAPI.markdown
Last active September 21, 2023 06:39
Creating a REST API using Node.js, Express, and MongoDB

###Creating a REST API using Node.js, Express, and MongoDB

####Installing Node.js

Go to http://nodejs.org, and click the Install button. Run the installer that you just downloaded. When the installer completes, a message indicates that Node was installed at /usr/local/bin/node and npm was installed at /usr/local/bin/npm. At this point node.js is ready to use. Let’s implement the webserver application from the nodejs.org home page. We will use it as a starting point for our project: a RESTful API to access data (retrieve, create, update, delete) in a wine cellar database.

Create a folder named nodecellar anywhere on your file system. In the wincellar folder, create a file named server.js.

@elidickinson
elidickinson / max_width_email.html
Created May 6, 2013 15:10
Email Template trick: max-width with outlook
<!--[if mso]>
<center>
<table><tr><td width="580">
<![endif]-->
<div style="max-width:580px; margin:0 auto;">
<p>This text will be centered and constrained to 580 pixels even on Outlook which does not support max-width CSS</p>
</div>
<!--[if mso]>
@hakre
hakre / dl-file.php
Created January 2, 2012 21:41
Wordpress login to download uploaded files
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+