Skip to content

Instantly share code, notes, and snippets.

View stemwinder's full-sized avatar

Joshua Smith stemwinder

View GitHub Profile
@JosephPecoraro
JosephPecoraro / shell-execution.rb
Last active September 10, 2023 10:12
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@jimeh
jimeh / show-and-hide-any-app.applescript
Created June 8, 2011 00:45
AppleScript to help make any app toggle-able via a global hotkeys like the Twitter and Sparrow apps.
-----------------------------------------
-- Show and Hide <application>
-----------------------------------------
--
-- This script allows you to easily
-- toggle the visibility of a specific
-- app, similar to how Twitter and
-- Sparrow toggle with their global
-- hotkey option.
--
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@digitaljhelms
digitaljhelms / gist:3099010
Created July 12, 2012 15:58
Squash the first two commits in a git repository's history

The scenario

Your repository has two commits:

$ git log --oneline
957fbfb No, I am your father.
9bb71ff A long time ago in a galaxy far, far away....
@electricg
electricg / Compass.sublime-build
Last active October 10, 2015 19:48
SublimeText2 - my User settings
{
"cmd": ["cd '$project_path'; compass watch"],
"working_dir": "$packages/Compass",
"selector": "source.sass",
"shell": "true",
"windows":
{
"cmd": ["compasswatch.bat", "$project_path"]
},
"osx":
@jasdeepkhalsa
jasdeepkhalsa / longPolling.js
Last active April 17, 2024 10:59
Simple Long Polling Example with JavaScript and jQuery by Tian Davis (@tiandavis) from Techoctave.com (http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery)
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast)
(function poll(){
$.ajax({ url: "server", success: function(data){
//Update your dashboard gauge
salesGauge.setValue(data.value);
}, dataType: "json", complete: poll, timeout: 30000 });
})();
@javan
javan / remove_hover.js.coffee
Created December 29, 2012 04:05
Remove :hover styles from mobile browsers
if 'createTouch' of document
ignore = /:hover\b/
try
for stylesheet in document.styleSheets
idxs = []
# detect hover rules
for rule, idx in stylesheet.cssRules
if rule.type is CSSRule.STYLE_RULE and ignore.test(rule.selectorText)
idxs.unshift idx
@jlivni
jlivni / index.html
Last active December 11, 2015 17:48
topojson on gmaps
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html, body, #map_canvas { height: 100%; margin: 0;}
</style>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="https://raw.github.com/mbostock/topojson/master/topojson.js"></script>
<script src="https://raw.github.com/JasonSanford/GeoJSON-to-Google-Maps/master/GeoJSON.js"></script>
@danielmartins
danielmartins / array_remove_similar.php
Created March 18, 2013 01:05
PHP: Remove duplicates items of an array based on similarities
<?php
/**
* This functions runs like array_unique but is based on similarity
* and the math is based on similar_text to know better, see: php.net/similar_text
*
* @param [type] $array [description]
* @param integer $howMuch [description]
* @param [type] $callback [description]
* @return [type] [description]