Skip to content

Instantly share code, notes, and snippets.

@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@mnapoli
mnapoli / behat-reference.feature
Last active February 12, 2024 10:54
Behat Mink reference
# Given
Given I am on [the] homepage
Given I am on "url"
# When
When I go to [the] homepage
When I go to "url"
When I reload the page
@outadoc
outadoc / Keolis-API.md
Last active April 20, 2024 15:04
Keolis Real-time API

Keolis "open-data" : XML Realtime API

Les données retournées sont au format XML.

Document trouvé et modifié depuis Pastebin.

Récupérer la liste des lignes

var actionUtil = require('sails/lib/hooks/blueprints/actionUtil');
module.exports = function getCount (req, res) {
var Model = actionUtil.parseModel(req)
, criteria = actionUtil.parseCriteria(req);
Model.count(criteria, function(error, response) {
if (error) {
return res.serverError('database_error', error);
@albertbori
albertbori / Installation.md
Last active June 11, 2024 14:09
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
@jaumard
jaumard / proxy.js
Last active January 5, 2016 15:06
/**
* Node.js proxy to redirect domain to correct server
* Also check is server is alive or send a maintenance page
*/
var http = require('http'),
httpProxy = require('http-proxy'),
proxy = httpProxy.createProxyServer({}),
request = require('request'),
domains = {
"domain1.com" : "localhost:8080",
@anvaka
anvaka / 00.Intro.md
Last active June 4, 2024 13:48
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
@Akanoa
Akanoa / matex-bot.rb
Last active December 24, 2015 16:27
Converts LateX language into human readable characters
require 'sinatra'
require 'sinatra'
require "cgi"
require 'json'
require 'tex2png'
def upload(path)
`curl -F file=@#{path} -F token=xoxp-xxxxxxxxx-xxxxxxxxx https://slack.com/api/files.upload`
end
@rowanmanning
rowanmanning / README.md
Last active February 18, 2024 21:12
Writing a Friendly README. This a companion-gist to the post: http://rowanmanning.com/posts/writing-a-friendly-readme/
@ruebenramirez
ruebenramirez / setup-franz-ubuntu.sh
Created September 7, 2016 17:55
setup franz on ubuntu
#!/bin/bash
sudo rm -fr /opt/franz
sudo rm -fr /usr/share/applications/franz.desktop
# create installation dir
sudo mkdir -p /opt/franz
#install franz