Skip to content

Instantly share code, notes, and snippets.

View kyleparisi's full-sized avatar

Kyle Parisi kyleparisi

  • Newtown, PA
View GitHub Profile
@zbuc
zbuc / ScreenshotManager.m
Created February 26, 2012 11:13
NSImage base64 HTTP POST
- (void)uploadImage:(NSImage *)image
{
NSData *imageData = [image TIFFRepresentation];
NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:imageData];
imageData = [imageRep representationUsingType:NSPNGFileType properties:nil];
NSString *base64 = [imageData encodeBase64WithNewlines: NO];
@shashi
shashi / sneaky-dom.js
Last active March 29, 2016 18:29
Sneaky, Shady DOM
(function() {
function Sneaky (node) {
var lightNode = Polymer.dom(node)
this.lightNode = lightNode
this.node = lightNode.node
}
Sneaky.prototype = Polymer.dom()
Object.defineProperties(Sneaky.prototype, {
#!/bin/sh
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export HUBOT_SLACK_TOKEN=<REDACTED>
export HUBOT_LOG_LEVEL="info"
export HUBOT_AUTH_ADMIN=<REDACTED>
export REDIS_URL=redis://127.0.0.1:6379/hal
export HUBOT_DEFAULT_COMMANDS=""
cd $DIR/..
@tj
tj / Makefile
Last active March 11, 2017 13:31
imgix favicons
IMAGE_CDN = https://apex-inc.imgix.net
# Imgix image replacement.
images:
@echo "==> pointing images to $(IMAGE_CDN)"
@find build -type f -name "*.html" | xargs sed -i '' 's|src="/images|src="$(IMAGE_CDN)/images|g'
@find build -type f -name "*.html" | xargs sed -i '' 's|href="/images|href="$(IMAGE_CDN)/images|g'
.PHONY: images
@tj
tj / Connector.js
Last active November 26, 2019 15:43
import React from 'react'
const bgStyles = {
strokeWidth: 3,
strokeLinejoin: 'round',
strokeLinecap: 'round',
fill: 'none',
stroke: '#c3fdff'
}
@blackode
blackode / password_logger.ex
Created February 14, 2017 10:18
GenServer for simple logging mechanism
defmodule PasswordLogger do
use GenServer
# -------------#
# Client - API #
# -------------#
@moduledoc """
Documentation for Password_logger.
loggs the password
@shawn-crigger
shawn-crigger / superhead.html
Last active November 21, 2020 19:38
My HTML head meta tags
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="x-dns-prefetch-control" content="on">
<link rel="dns-prefetch" href="//ajax.googleapis.com">
<link rel="dns-prefetch" href="//farm7.staticflickr.com">
<meta http-equiv="X-UA-Compatible" content="IE=9">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?
@neverything
neverything / <stage>.rb
Last active March 6, 2021 12:32
Dirty opcache_reset() for capistrano deployments to shared php envs without access to restart the server. With some recommended settings for the opcache configuration in php.ini
# In your config/deploy/<stage>.rb files add the correct path which is publicly curlable :D
# Opcache file url
set :opcache_file_url, "https://<add_public_url_of_stage>/opcache_clear.php"
@euank
euank / README.md
Last active July 11, 2021 02:54
Fix chrome's console.log 'TypeError: Illegal invocation'

Chrome exhibits behavior different from firefox (and other javascript environments) in that console.log requires "this" to be console. This issue is discussed here.

Simple failing code is

var helloWorld = function(callback) { 
  callback("Hello World"); 
}; 
helloWorld(console.log);

The included snippet makes failing code function correctly without any other changes required. It just has to be run before any console.logs. Similar code can be written for console.info and so on.

@roxlu
roxlu / Encoding.cpp
Created October 22, 2014 18:17
Fix for return value -12780 when calling VTCompressionSessionEncodeFrame(). You need to pass the `nbytes` into the `CVPixelBufferCreateWithPlanarBytes()` function otherwise you'll get this return value.
#include "Encoding.h"
/* ------------------------------------------------------------------- */
static void output_callback(void* outputCallbackRefCon,
void* sourceFrameRefCon,
OSStatus status,
VTEncodeInfoFlags infoFlags,
CMSampleBufferRef sampleBuffer);