Skip to content

Instantly share code, notes, and snippets.

View Jpunt's full-sized avatar

Jasper Haggenburg Jpunt

View GitHub Profile
@Jpunt
Jpunt / console-fallback.js
Last active January 2, 2016 17:09
Fallback to use things like console.log() but not have it kill old browsers.
// This is not some kind of polyfill! It's just to prevent old browsers from failing horribly
var fallback = function() {};
var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'profile', 'profileEnd', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn', 'table'];
if(typeof console === 'undefined') {
var console = {};
}
for(var i in methods) {
require 'rubygems'
if ENV['CODECLIMATE_REPO_TOKEN']
require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start
else
require 'simplecov' unless File.exists? '.zeus.sock'
end
ENV['RAILS_ENV'] = 'test'
@Jpunt
Jpunt / grid-basic.css
Last active August 29, 2015 14:01
T1000 examples
@media only screen and (max-width: 399px) {
.row { padding: 8px; }
.col { padding: 8px; }
.s-1 { width: 8.33333%; }
.s-2 { width: 16.66667%; }
.s-3 { width: 25%; }
.s-4 { width: 33.33333%; }
.s-5 { width: 41.66667%; }
.s-6 { width: 50%; }
@Jpunt
Jpunt / phantom-and-jasmine.spec.js
Last active August 29, 2015 14:04
Functional test with Node, Phantom and Jasmine
// npm install phantom
// npm install jasmine-node
// ./node_modules/jasmine-node/bin/jasmine-node phantom-and-jasmine.spec.js
var phantom = require('phantom');
describe("A suite", function() {
it("should open google.com", function(done) {
phantom.create(function(ph) {
ph.createPage(function(page) {
const jsdom = require("jsdom");
jsdom.env({
html: `
<!DOCTYPE html>
<body>
<script>
var script = document.createElement("script");
script.setAttribute('type', 'application/javascript');
script.textContent = "ran = true;";
const jsdom = require("jsdom");
jsdom.env({
html: `
<!DOCTYPE html>
<body>
<script>
var script = document.createElement("script");
script.setAttribute('type', 'application/javascript');
script.textContent = "ran = true;";

Keybase proof

I hereby claim:

  • I am jpunt on github.
  • I am jpunt (https://keybase.io/jpunt) on keybase.
  • I have a public key whose fingerprint is 0BB3 1062 FEB1 9586 7C99 BAA1 0233 D5E8 8124 495E

To claim this, I am signing this object:

# When using RN in combination with Cocoapods, a lot of
# things are broken. These are the fixes we had to append
# to our Podfile when upgrading to ReactNative@0.55.3.
#
# WARNING: Check those line numbers when you're on a different version!
def change_lines_in_file(file_path, &change)
print "Fixing #{file_path}...\n"
contents = []
@Jpunt
Jpunt / npm-alfred.md
Created July 12, 2018 09:12
Some handy shortcuts for npm and Alfred

npm shortcuts for Alfred

screenshot

Copy/paste these into Safari and it will add it to Alfred

Search for package

alfred://customsearch/Search%20npm%20for%20%27%7Bquery%7D%27/npm/utf8/nospace/https%3A%2F%2Fwww.npmjs.com%2Fsearch%3Fq%3D%7Bquery%7D
@Jpunt
Jpunt / btt-toggle-appearance.json
Created September 25, 2018 12:26
BetterTouchTool: Toggle Mojave appearance on the Touch Bar
{
"BTTWidgetName" : "Toggle appearance",
"BTTTriggerType" : 639,
"BTTTriggerTypeDescription" : "Apple Script Widget",
"BTTTriggerClass" : "BTTTriggerTypeTouchBar",
"BTTPredefinedActionType" : 195,
"BTTPredefinedActionName" : "Run Apple Script (async in background)",
"BTTInlineAppleScript" : "tell application \"System Events\"\r\ttell appearance preferences\r\t\tset dark mode to not dark mode\r\tend tell\rend tell",
"BTTEnabled2" : 1,
"BTTUUID" : "ECC2514E-86E5-4304-AABA-BA7749257FDC",