Skip to content

Instantly share code, notes, and snippets.

View calvindavis's full-sized avatar
😐

Calvin Davis calvindavis

😐
View GitHub Profile
@calvindavis
calvindavis / input.scss
Created September 16, 2021 09:26
Generated by SassMeister.com.
.form-field {
$this: &;
@apply relative block;
&__label {
@apply block cursor-pointer;
.emailaddress &,
.longanswer &,
@calvindavis
calvindavis / SaveMediaController.cs
Created March 2, 2020 18:33
Save all media in Umbraco 8
using System.Web.Http;
using Umbraco.Core.Services;
using Umbraco.Web.WebApi;
namespace Yoyo.Elevator.Core.Controllers
{
public class SaveMediaController : UmbracoApiController
{
private readonly IMediaService _mediaService;
SSH_ENV=$HOME/.ssh/environment
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
@calvindavis
calvindavis / SassMeister-input.scss
Created August 1, 2018 16:09
Generated by SassMeister.com.
// ----
// Sass (v3.4.25)
// Compass (v1.0.3)
// ----
@mixin font-size($font-size, $line-height: null) {
font-size: $font-size;
@if $line-height != null {
@if unit($font-size) == unit($line-height) {
@calvindavis
calvindavis / gist:754331750df91836a2ce
Last active August 29, 2015 14:08
Looking at Gist's PJAX form submission
// Nothing here, sorry!
javascript:var a=document.querySelectorAll("*"),b,c=function(){return Math.round(Math.random()*255);},d=function(){return "rgb("+c()+","+c()+","+c()+")";};setInterval(function(){for(b=0;b<a.length;b+=1){a[b].style.backgroundColor=d();a[b].style.color=d();}},250);return false;
@calvindavis
calvindavis / gist:6306382
Created August 22, 2013 12:10
Bookmarklet for refreshing stylesheets.
javascript:var a=document.querySelectorAll('link[rel="stylesheet"]'),b,c,d,e='href';for(b in a){c=a[b];d=c[e];c[e]='';c[e]=d}
@calvindavis
calvindavis / cypher-toggle-relationship
Created June 27, 2013 13:38
Cypher query for toggling a relationship between two nodes.
START calvin = node(1), sophie = node(2)
CREATE (calvin)-[:LIKES]->(sophie)
MATCH (calvin)-[r:LIKES]->(sophie), (calvin)-[:LIKES]->(sophie)
DELETE r
RETURN count(r) = 1 AS likes
@calvindavis
calvindavis / gist:5354279
Created April 10, 2013 12:43
Caching jQuery objects.
// Don't do this:
for (var i = 0; i < 100; i += 1) {
$("#foo").text(i);
}
// Do this instead:
var $foo = $("#foo");
for (var i = 0; i < 100; i += 1) {
$foo.text(i);
}