Skip to content

Instantly share code, notes, and snippets.

View ipatate's full-sized avatar
🏠
Working from home

Patrick Faramaz ipatate

🏠
Working from home
View GitHub Profile
@kylebarrow
kylebarrow / example.html
Created June 23, 2011 06:30
Prevent links in standalone web apps opening Mobile Safari
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>
@dhavaln
dhavaln / camera.html
Created March 29, 2012 14:33
Phonegap Camera Capture Example
<!DOCTYPE html>
<html>
<head>
<title>Capture Photo</title>
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1"/>
<script type="text/javascript" charset="utf-8" src="js/phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
var pictureSource; // picture source
var destinationType; // sets the format of returned value
@bobbydavid
bobbydavid / app.js
Created May 8, 2012 23:46
socket.io in Express 3
var express = require('express')
, http = require('http')
, connect = require('connect')
, io = require('socket.io');
var app = express();
/* NOTE: We'll need to refer to the sessionStore container later. To
* accomplish this, we'll create our own and pass it to Express
* rather than letting it create its own. */
var sessionStore = new connect.session.MemoryStore();
@DaRaFF
DaRaFF / ubuntu-php-development-environment.md
Last active October 13, 2023 00:16
Ubuntu php development environment

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

@AndrewHenderson
AndrewHenderson / index.html
Created November 5, 2012 02:18
Demo: How to Effectively Remove Backbone Views to Avoid Memory Leaks
<!DOCTYPE HTML>
<html>
<head>
<title>Backbone Memory Management</title>
<link href="style.css">
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet">
</head>
<body>
<div id="app" class="container">
<h1>Zombie Destroyer 3000</h1>
@pasupulaphani
pasupulaphani / after_res_hooks.js
Last active May 1, 2024 20:37
Mongoose connection best practices
var db = mongoose.connect('mongodb://localhost:27017/DB');
// In middleware
app.use(function (req, res, next) {
// action after response
var afterResponse = function() {
logger.info({req: req}, "End request");
// any other clean ups
@codler
codler / flex.less
Last active October 7, 2023 07:01
Prefix flex for IE10 and Safari / iOS in LESS
/*! Prefix flex for IE10 and Safari / iOS in LESS
* https://gist.github.com/codler/2148ba4ff096a19f08ea
* Copyright (c) 2014 Han Lin Yap http://yap.nu; MIT license */
.display(@value) when (@value = flex) {
display: -ms-flexbox; // IE10
display: -webkit-flex; // Safari / iOS
}
.display(@value) when (@value = inline-flex) {
@jbmoelker
jbmoelker / bootstrap.js
Last active January 15, 2016 19:22
requirejs-bootstrap-plugin
// Create shim for requested bootstrap component and require
// and return jQuery so you do not have to inject it separately
// every time you use a bootstrap component.
define({
load: function (name, req, onload, config) {
// Set this path to wherever the bootstrap components live.
// Contents should match https://github.com/twbs/bootstrap/tree/master/js
var component = 'path/to/bootstrap/js/'+name;
var shim = {};
@Ciantic
Ciantic / gist:8a09107fcd9bed8bede0
Created June 24, 2014 16:41
WordPress select and checkboxes metabox callback
<?php
/**
* Show taxonomy selection in WordPress admin as single <select> box or checkboxes
*
* @author Jari Pennanen / https://github.com/ciantic
* @license Public Domain
**/
// Usage example:
register_taxonomy("my_taxonomy", array("post"), array(
@m1r0
m1r0 / wp_insert_attachment_from_url.php
Last active April 11, 2024 12:33
WP: Insert attachment from URL
<?php
/**
* Insert an attachment from a URL address.
*
* @param string $url The URL address.
* @param int|null $parent_post_id The parent post ID (Optional).
* @return int|false The attachment ID on success. False on failure.
*/
function wp_insert_attachment_from_url( $url, $parent_post_id = null ) {