Skip to content

Instantly share code, notes, and snippets.

View zazk's full-sized avatar
:octocat:
Let's talk about Javascript & DevOps

Enrique Juan de Dios zazk

:octocat:
Let's talk about Javascript & DevOps
View GitHub Profile
@kdonald
kdonald / CorisFilter.java
Created March 29, 2012 01:12
Basic Cross Origin Resource Sharing (CORS) support
package org.springframework.web.servlet.support;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.filter.OncePerRequestFilter;
@christineyen
christineyen / actionSheetStandard.m
Created May 3, 2012 21:05
Framework vs. BlocksKit handling, for blog
- (IBAction)clickedCloseButton:(id)sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Discard post?"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Discard"
otherButtonTitles:@"Save draft", nil];
[actionSheet showInView:self.view];
}
// UIActionSheetDelegate methods
@jancbeck
jancbeck / wp-role-bodyclass.php
Last active January 15, 2022 19:34
WordPress: Add user role class to body tag
<?php
// Add role class to body
function add_role_to_body($classes) {
foreach (wp_get_current_user()->roles as $user_role) {
$classes[] = 'role-'. $user_role;
}
return $classes;
});
add_filter('body_class','add_role_to_body');
@ronkorving
ronkorving / ios6-timers.js
Last active March 9, 2022 03:40
iOS6 webkit timer bug workaround
(function (window) {
// This library re-implements setTimeout, setInterval, clearTimeout, clearInterval for iOS6.
// iOS6 suffers from a bug that kills timers that are created while a page is scrolling.
// This library fixes that problem by recreating timers after scrolling finishes (with interval correction).
// This code is released in the public domain. Do with it what you want, without limitations. I do not promise
// that it works, or that I will provide support (don't sue me).
// Author: [email protected]
var timeouts = {};
@kTmnh
kTmnh / ios6-timers.js
Last active April 27, 2022 21:24 — forked from ronkorving/ios6-timers.js
iOS6 webkit timer bug workaround
(function (window) {
// This library re-implements setTimeout, setInterval, clearTimeout, clearInterval for iOS6.
// iOS6 suffers from a bug that kills timers that are created while a page is scrolling.
// This library fixes that problem by recreating timers after scrolling finishes (with interval correction).
// This code is free to use by anyone (MIT, blabla).
// Original Author: [email protected]
var timeouts = {};
var intervals = {};
var orgSetTimeout = window.setTimeout;
var orgSetInterval = window.setInterval;
@media only screen and (min--moz-device-pixel-ratio: 1.5), /* Gecko */
only screen and (-o-min-device-pixel-ratio: 3/2), /* Opera */
only screen and (-webkit-min-device-pixel-ratio: 1.5), /* Webkit */
only screen and (min-device-pixel-ratio: 1.5), /* Webkit */
only screen and (min-resolution: 144dpi) /* W3 */
{
.button-icon {
background-image: url("path/to/image/[email protected]");
background-size: 16px 16px;
}
@codeswimmer
codeswimmer / ios_simple_pasteboard.m
Created January 2, 2013 20:10
iOS: Simple Usage Of UIPasteBoard
Basically, UIPasteBoard allows us to share data to other application. Below is an example of UIpasteBoard usage.
COPY
UIPasteboard *appPasteBoard = [UIPasteboard generalPasteboard];
appPasteBoard.persistent = YES;
[appPasteBoard setString:@"STRING TO COPY"];
PASTE
@paul-delange
paul-delange / HighChartViewController.h
Created March 27, 2013 11:03
Highcharts running in a UIWebView for iOS
#import <UIKit/UIKit.h>
@interface HighChartViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@property (strong, nonatomic) NSArray* seriesArray;
@property (copy, nonatomic) NSString* optionFileName;
@end
@gnrfan
gnrfan / fsjumps.sh
Created August 19, 2013 08:18
Easily remember a directory and jump back to it from anywhere in the UNIX filesystem. This version is optimized for Mac OS X. Source: http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html
### Filesystem jumping
### Usage: Just add a line to your ~/.bashrc or ~/.bash_profile with "source /path/to/fsjumps.sh".
export MARKPATH=$HOME/.marks
function jump {
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
}