Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View elsurudo's full-sized avatar

Ernest Surudo elsurudo

View GitHub Profile
@AllThingsSmitty
AllThingsSmitty / script-loaded.js
Created May 5, 2015 13:25
Check if any given script has loaded
var myScript = document.createElement('script');
myScript.src = 'http://code.jquery.com/jquery-2.1.4.min.js';
myScript.onload = function() {
console.log('jQuery loaded.');
};
document.body.appendChild(myScript);
@DimaVartanian
DimaVartanian / CrashlyticsSwift.Swift
Last active June 8, 2019 10:16
Crashlytics CLS_LOG() in Swift
//
// Created by Dima Vartanian on 10/29/15.
//
import Foundation
import Crashlytics
// this method gives us pretty much the same functionality as the CLS_LOG macro, but written as a Swift function, the only differences are that we have to use array syntax for the argument list and that we don't get see if the method being called is a class method or an instance method. We also have to define the DEBUG compiler flag with -D DEBUG.
/// Usage:
///
@josheinstein
josheinstein / gist:5586469
Last active October 15, 2022 02:13
Handle back button issues with Twitter Bootstrap's tab component.
// Handle back button issues with Twitter Bootstrap's tab component.
// Based on: http://stackoverflow.com/a/10120221/81769
// It has been changed to avoid the following side effects:
// - Switching tabs was being added to navigation history which is undesirable
// (Worked around this by using location.replace instead of setting the hash property)
// - Browser scroll position was lost due to fragment navigation
// (Worked around this by converting #id values to #!id values before navigating.)
$(document).ready(function () {
if (location.hash.substr(0,2) == "#!") {
<?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>Information</key>
<dict>
<key>Description</key>
<string>Map Rails ActiveSupport timezones to iOS readable timezone IDs.</string>
<key>Version</key>
<string>1.0</string>
@peter
peter / creating-edgerails-app.sh
Created June 30, 2012 21:03
Creating and Deploying an EdgeRails (Rails 4) Application to Heroku
# 0. Make sure you have Ruby 1.9.3 installed, and optionally RVM and PostgreSQL
# 0.2 If you are on the Mac, make sure you have a c compiler by installing XCode Command Line Tools or gcc4.2 with homebrew
# https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers
# 0.5 Make sure you have bundler version ~> 1.2 as Rails depends on it
gem install bundler
# 1. Get edge Rails source (master branch)
git clone https://github.com/rails/rails.git
@awesome
awesome / strip HTML tags
Created November 3, 2009 16:29
ruby strip HTML tags
# copied from (thanks!): http://codesnippets.joyent.com/posts/show/615
str = <<HTML_TEXT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h1>Application error</h1>
<p>Change this error message for exceptions thrown outside of an action (like
in Dispatcher setups or broken Ruby code) in public/500.html</p>