Skip to content

Instantly share code, notes, and snippets.

View sterlingwes's full-sized avatar
🍉

Wes Johnson sterlingwes

🍉
View GitHub Profile
@dhavaln
dhavaln / index.html
Created June 7, 2012 05:44
Include Phonegap/Cordova JS based on the Device
<!DOCTYPE HTML>
<html>
<!DOCTYPE HTML>
<head>
<meta name="viewport" content="width=320; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PhoneGap Test</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.css" >
<script type="text/javascript" charset="utf-8"
@damncabbage
damncabbage / factories.js
Created August 16, 2012 01:52
FactoryGirl-ish definitions in Jasmine
/*
* Set up factories, then create them in tests with (for example):
*
* LineItemFactory();
*
* Or with attributes / overrides:
*
* LineItemFactory({
* "id": 123,
* "order": OrderFactory({"firstName": "Example Associated Record Override"}),
@thomseddon
thomseddon / gist:3834721
Created October 4, 2012 16:21
AngularJS: Avoid redirection loop in legacy browser (IE) with HTML5 mode
var buggyAndroid = parseInt((/android (\d+)/.exec(window.navigator.userAgent.toLowerCase()) || [])[1], 10) < 4;
if (!history.pushState || buggyAndroid) {
if (window.location.hash) {
if(window.location.pathname !== '/') window.location.replace('/#!' + window.location.hash.substr(2)); //Hash and a path, just keep the hash (redirect)
} else {
window.location.replace('/#!' + window.location.pathname); //No hash, take path
}
}
//And then in app.config:
# Support running Whenever cron jobs with Lockrun
# Lockrun: http://www.unixwiz.net/tools/lockrun.html
# lockrun typically installed at /usr/bin/lockrun
# On Mac, install with: brew install lockrun
# Lockrun prefix for cronjobs: /usr/bin/lockrun --lockfile=/path/to/tmp/JOBNAME.lockrun -- sh -c "COMMAND"
def wrap_with_lockrun command
"/usr/bin/env lockrun --lockfile=:path/tmp/:lockfile.lockrun -- sh -c \"#{ command }\""
end
#redefine the three default job types to use Lockrun (i.e. just add 'lockrun_' in front of the existing job names)
@dylants
dylants / myapp.conf
Last active October 8, 2018 16:29
upstart config file for running node.js on a linux machine. This uses nodemon to allow file changes when pulled from git. This also specifies the NODE_ENV environment variable as "production" which would trigger the app to production mode (as opposed to development). Remove the environment variable if development environment is desired.
#!upstart
description "nodemon server for myapp"
author "ubuntu"
start on startup
stop on shutdown
script
export HOME="/home/ubuntu/git/myapp"
@trinnguyen
trinnguyen / config.yml
Last active October 19, 2018 14:58
CircleCI 2.0 Android config with Keystore Signing
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-25-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
@dlukez
dlukez / ngTagsInput-restrictToMaxTags.js
Last active November 7, 2019 16:53
A directive that extends mbenford/ngTagsInput to hide the tags input when the max tags limit is been reached.
/**
* A directive to hide the tags input when the max tags limit is reached.
* Works with github.com/mbenford/ngTagsInput
*/
angular.module('dz.restrictToMaxTags', ['ngTagsInput']).directive( 'restrictToMaxTags', function () {
var KEY_BACKSPACE = 8
KEY_TAB = 9;
return {
require: 'ngModel',
@asmallteapot
asmallteapot / .gitattributes
Last active March 31, 2022 11:43
Diff Xcode localizable strings files in Git.
*.strings utf16 diff=localizablestrings
@gabrielhpugliese
gabrielhpugliese / meteor-windows-vagrant-tutorial.md
Last active April 19, 2022 14:37
Tutorial for running Meteor in Windows using Vagrant

Tutorial: Meteor in Windows using Vagrant

BEFORE YOU CONTINUE:

  • Now, Meteor runs in any Windows without any line of this tutorial. Just download the Meteor binary! Yay!!
  • mrt is no longer used with Meteor 1.0

These days some people were discussing at meteor-talk group about running Meteor at Windows and I’ve recommended them using Vagrant. It’s a very developer-friendly piece of software that creates a virtual machine (VM) which let you run any operating system wanted and connect to it without big efforts of configuration (just make the initial installation and you have it working).

Many packages (I've tested) for running Meteor+Vagrant fails because Meteor writes its mongodb file and also other files inside local build folder into a shared folder between the Windows host and the Linux guest, and it simply does not work. So I've put my brain to work and found a solution: do symlinks inside the VM (but do not use ln. Use mount so git can follow it). It’s covered on

@maxim
maxim / task.yml
Created June 12, 2014 11:09
Adding github to known_hosts with ansible
- name: ensure github.com is a known host
lineinfile:
dest: /root/.ssh/known_hosts
create: yes
state: present
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}"
regexp: "^github\\.com"