Skip to content

Instantly share code, notes, and snippets.

View adamrights's full-sized avatar

Adam Bedell adamrights

View GitHub Profile
@thoop
thoop / nginx.conf
Last active April 14, 2025 17:11
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active March 12, 2025 01:22
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
#Find out, which device is bound to the driver:
find /sys/bus/pci/drivers/mei_me/ -type l|sed 's#^.*/##'
0000:00:03.0
#Now unbind (as root):
echo 0000:00:03.0 > /sys/bus/pci/drivers/mei_me/unbind
#…and your next resume will work better.
@LeeHyungGeun
LeeHyungGeun / angularjsDemo03_.idea_.name
Last active June 19, 2021 19:07
Single Page App : Node.js + AngularJS + MongoDB
angularjsDemo03
#!/usr/bin/php
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
/*
* Using of script in command line:
* ./csv-to-json.php csv.file.name.or.url > json.file.name
@gr2m
gr2m / store.dreamcode.js
Last active February 23, 2020 00:03
Imagine saving and finding user data would work right in the browser, persistent and synchronised. How would the code look like? This is what I came up with. Forks & comments much appreciated! #nobackend #dreamcode
// add a new object
var type = 'note';
var attributes = {color: 'red'};
store.add(type, attributes)
.done(function (newObject) {});
.fail(function (error) {});
// update an existing object
var type = 'note';
var id = 'abc4567';
@adamrights
adamrights / snp
Created April 12, 2013 12:18 — forked from erikw/snp
#!/usr/bin/env bash
# Runs a command wrapped with btrfs pre-post snapshots.
log_path="/var/local/log/snp"
date=$(date "+%Y-%m-%d-%H%M%S")
log_file="${log_path}/snp_${date}.log"
# Log stdout and stderr. Reference: http://stackoverflow.com/questions/3173131/redirect-copy-of-stdout-to-log-file-from-within-bash-script-itself
exec > >(tee -a "$log_file")
exec 2> >(tee -a "$log_file" >&2)
@nubz
nubz / Gruntfile.js
Last active December 16, 2015 01:39 — forked from tanepiper/Gruntfile.js
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
aws: grunt.file.readJSON('config/grunt-aws.json'),
datetime: Date.now(),
jshint: {
@everyplace
everyplace / .env
Last active December 15, 2015 10:29
For use with express-passport-template: https://github.com/everyplace/express-passport-template
COOKIE_SECRET="It's a secret to everybody"
FLICKR='{"api_key":"XXXXXX", "api_secret":"XXXXXX", "callback_url":"https://XXXXXX/auth/flickr/callback"}'
TWITTER='{"consumer_key":"XXXXXX", "consumer_secret":"XXXXXX","request_token_url":"https://api.twitter.com/oauth/request_token","authorize_url":"https://api.twitter.com/oauth/authorize","access_token_url":"https://api.twitter.com/oauth/access_token","callback_url":"http://XXXXXX/auth/twitter/callback"}'
GOOGLE='{"web":{"auth_uri":"https://accounts.google.com/o/oauth2/auth","client_secret":"XXXXXX","token_uri":"https://accounts.google.com/o/oauth2/token","client_email":"XXXXXX","redirect_uris":["https://XXXXXX/auth/google/callback"],"client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/XXXXXX","client_id":"XXXXXX","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","javascript_origins":["XXXXXX"]}}'
GOOGLE_SCOPE='["https://www.googleapis.com/auth/userinfo.profile","https://www.googleapis.com/auth/userinfo.email"]'
GOOGLE