Skip to content

Instantly share code, notes, and snippets.

@bryfox
bryfox / dnsmasq.md
Created June 15, 2017 20:10 — forked from nickcernis/dnsmasq.md
dnsmasq

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

Install

@bryfox
bryfox / wiki.lua
Created February 7, 2017 20:15 — forked from zhzhxtrrk/wiki.lua
pandoc confluence markup writer
-- that is very similar to that of pandoc's HTML writer.
-- There is one new feature: code blocks marked with class 'dot'
-- are piped through graphviz and images are included in the HTML
-- output using 'data:' URLs.
--
-- Invoke with: pandoc -t sample.lua
--
-- Note: you need not have lua installed on your system to use this
-- custom writer. However, if you do have lua installed, you can
-- use it to test changes to the script. 'lua sample.lua' will
#!/bin/bash
# usage :
# generate-iOS-app-icons.sh someDir/sourceImage-1024x1024.png path/where/ImagesAssets/is/located
mkdir -p generated
# you'll have to delete this one after executing the script if you copy the generated images in the Images asset
SOURCE_ICON="$1"
PATH_TO_IMAGES_ASSET="$2"
@bryfox
bryfox / drag_and_drop_helper.js
Created March 30, 2016 21:27 — forked from rcorreia/drag_and_drop_helper.js
drag_and_drop_helper.js
(function( $ ) {
$.fn.simulateDragDrop = function(options) {
return this.each(function() {
new $.simulateDragDrop(this, options);
});
};
$.simulateDragDrop = function(elem, options) {
this.options = options;
this.simulateEvent(elem, options);
};
@bryfox
bryfox / angularjs_directive_attribute_explanation.md
Created December 5, 2015 00:48 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@bryfox
bryfox / alea.js
Created September 22, 2013 01:00 — forked from kirbysayshi/alea.js
// From http://baagoe.com/en/RandomMusings/javascript/
function Alea() {
return (function(args) {
// Johannes Baagøe <baagoe@baagoe.com>, 2010
var s0 = 0;
var s1 = 0;
var s2 = 0;
var c = 1;
if (args.length == 0) {
@bryfox
bryfox / index.php
Created October 29, 2011 22:08 — forked from lyzadanger/index.php
AppCache demo w/jQuery Mobile & PHP
<!DOCTYPE html>
<html manifest="manifest.appcache.php">
<head>
<title>AppCache Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.js"></script>
@bryfox
bryfox / gist:1295577
Created October 18, 2011 14:34 — forked from defunkt/gist:132456
Save last shell dir. Support for spaces in path.
# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
#
# Put this in your .bashrc or whatever.
pathed_cd () {
if [ "$1" == "" ]; then
cd
else
@bryfox
bryfox / fb-comments.rb
Created January 7, 2010 00:58 — forked from mjfreshyfresh/fb-comments.rb
Facebook comment callback (_method fix)
# app_helper
def callback_attribute
%{ callbackurl="#{url_for(request.path) + "?_method=GET&" + request.query_string}" }
end
# in the view
<fb:comments xid="m_story_<%= @first.id %>_comments" canpost="true" candelete="false" showform="true" numposts="5" publish_feed="false" simple="true" reverse="true" returnurl="<%= link_to_app "item/#{@first.id}" %>" <%= callback_attribute %>>
<fb:title> <%= @first.couple_name %></fb:title>
</fb:comments>
@bryfox
bryfox / fb-comments.rb
Created December 3, 2009 23:05 — forked from mjfreshyfresh/fb-comments.rb
with new link_to_app
# app_helper
def callback_attribute
if request.env['PATH_INFO']
" callbackurl='#{link_to_app(request.env['PATH_INFO'])}?_method=GET' "
end
end
# in the view
<fb:comments xid="m_story_<%= @first.id %>_comments" canpost="true" candelete="false" showform="true" numposts="5" publish_feed="false" simple="true" reverse="true" returnurl="<%= link_to_app "item/#{@first.id}" %>" <%= callback_attribute %>>
<fb:title> <%= @first.couple_name %></fb:title>