Skip to content

Instantly share code, notes, and snippets.

View antranapp's full-sized avatar

An Tran antranapp

View GitHub Profile
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@erikjung
erikjung / gist:2248503
Created March 30, 2012 07:17
Using MustacheLoader class
<?php
include './../lib/mustache/Mustache.php';
include './../lib/mustache/MustacheLoader.php';
$template = <<<HTML
<body>
<header>{{header}}</header>
{{> partials/footer}}
</body>
HTML;
@benediktarnold
benediktarnold / sortable-yui3-tab.html
Created May 4, 2012 07:44
In this example you can see a sortable yui3 tabview with drag and drop.
<!doctype html>
<html>
<head>
<title>
</title>
<script src="http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js">
</script>
</head>
@dhavaln
dhavaln / filesystem.js
Created June 8, 2012 08:51
PhoneGap Filesystem Example
/**
* Prepare the App Folder
*/
(function(){
window.appRootDirName = ".myapp";
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log("device is ready");
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
@zhouming
zhouming / MY_Session.php
Created September 8, 2012 05:51
Use redis in Codeigniter Session.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session extends CI_Session{
private $sess_use_redis = TRUE;
private $redis = '';
public function __construct($params = array()) {
//parent::__construct();
$this->CI =& get_instance();
@linktoming
linktoming / gist:3986189
Created October 31, 2012 10:00
Crop and Scale CGContext - iOS
//Crop and Scale CGContext - iOS
//http://pastebin.com/8xWrr1tv
- (void)modifyImage:(CMSampleBufferRef) sampleBuffer {
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
// Lock the image buffer
CVPixelBufferLockBaseAddress(imageBuffer,0);
// Get information about the image
uint8_t *baseAddress = (uint8_t *)CVPixelBufferGetBaseAddress(imageBuffer);
@callado4
callado4 / behat-phantomjs-webdriver.md
Last active January 24, 2021 17:10
Instructions on how to make behat (with mink) use the phantomjs webdriver to run headless browser tests

Making behat use phantomjs for the tests

If you want to run it on phantomjs (a headless browser) you can add this profile to your behat.yml and you need phantomjs >= 1.8.0

phantomjs:
    extensions:
        Behat\MinkExtension\Extension:
            base_url: http://dev.local
            goutte: ~
            selenium2:
 wd_host: "http://localhost:8643/wd/hub" 
@jyliang
jyliang / vImageScaledImage
Created March 11, 2014 17:36
vImageScaledImage
// Method: vImageScaledImage:(UIImage*) sourceImage withSize:(CGSize) destSize
// Returns even better scaling than drawing to a context with kCGInterpolationHigh.
// This employs the vImage routines in Accelerate.framework.
// For more information about vImage, see https://developer.apple.com/library/mac/#documentation/performance/Conceptual/vImage/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001001-CH201-TPXREF101
// Large quantities of memory are manually allocated and (hopefully) freed here. Test your application for leaks before and after using this method.
+ (UIImage*) vImageScaledImage:(UIImage*) sourceImage withSize:(CGSize) destSize;
{
UIImage *destImage = nil;
if (sourceImage)
@steve-jansen
steve-jansen / README.md
Last active May 21, 2024 04:59
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@brutella
brutella / icons
Last active August 29, 2023 15:10
Generate iOS, watchOS, and macOS app icons from one image
#! /bin/sh
function print_example() {
echo "Example"
echo " icons ios ~/AppIcon.pdf ~/Icons/"
}
function print_usage() {
echo "Usage"
echo " icons <ios|watch|complication|macos> in-file.pdf (out-dir)"