Skip to content

Instantly share code, notes, and snippets.

View surfjedi's full-sized avatar
🤪

Lee Blazek surfjedi

🤪
View GitHub Profile
@surfjedi
surfjedi / fetch-interceptor.js
Created March 1, 2018 18:04
fetch interceptor
//NOTE: inspired and modified form https://github.com/werk85/fetch-intercept
function attach(env) {
// Make sure fetch is available in the given environment
if (!env.fetch) {
try {
console.log('Env has fetch available');
// require('whatwg-fetch');
} catch (err) {
throw Error('No fetch available. Unable to register fetch-intercept');
@cocoaNib
cocoaNib / exportOptionsAdHoc.plist
Last active April 2, 2024 01:41
Xcode build with exportOptionsPlist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>ad-hoc</string>
</dict>
</plist>
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@javierarques
javierarques / protractorAPICheatsheet.md
Last active January 31, 2023 08:51
Protractor API Cheatsheet
@surfjedi
surfjedi / css-calc.html
Created June 17, 2014 03:23
Fixed height header and footer with percentage middle section filling - css calc() example
<html>
<head>
<style>
html, body {
height: 100%;
overflow: hidden;
}
#top {
background: red;
height: 40px;
@akhoury
akhoury / handlebars-helper-x.js
Last active February 17, 2024 13:25
Handlebars random JavaScript expression execution, with an IF helper with whatever logical operands and whatever arguments, and few more goodies.
// for detailed comments and demo, see my SO answer here http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/21915381#21915381
/* a helper to execute an IF statement with any expression
USAGE:
-- Yes you NEED to properly escape the string literals, or just alternate single and double quotes
-- to access any global function or property you should use window.functionName() instead of just functionName()
-- this example assumes you passed this context to your handlebars template( {name: 'Sam', age: '20' } ), notice age is a string, just for so I can demo parseInt later
<p>
{{#xif " name == 'Sam' && age === '12' " }}
BOOM
@rboyd
rboyd / ios_detect.coffee
Created November 1, 2011 21:27
Detect iPhone user agent, offer app download, and javascript redirect to iTunes App Store
OFFER = 'We have an app available in the App Store! Download now?'
ITUNES_URL = '<Your iTunes URL Here>'
createCookie = (name,value,days) ->
if days
date = new Date()
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 365))
expires = '; expires=' + date.toGMTString()
else
expires = ''