Skip to content

Instantly share code, notes, and snippets.

View raidenz's full-sized avatar

raidenz raidenz

View GitHub Profile
@raidenz
raidenz / mediaquery.css
Last active March 9, 2016 09:37
bootstrap full mediaquery
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
}
/* Extra Small Devices, Phones */
@media only screen and (min-width : 480px) {
}
/* Small Devices, Tablets */
@raidenz
raidenz / README.md
Created March 20, 2016 06:03 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@raidenz
raidenz / dinamic_css_js.php
Last active May 5, 2016 06:52
codeigniter dynamic css and js
//credit http://jamshidhashimi.com/2013/04/12/dynamically-add-javascript-and-css-files-in-codeigniter-header-page/
// add to config
$config['header_css'] = array('style.css','prettyPhoto.css','nivo-slider.css');
$config['header_js'] = array('core.js','core.js',
'jquery-1.4.1.min.js',
'jquery-slidedeck.pack.lite.js',
'jquery-prettyPhoto.js',
'jquery.nivo.slider.js');
// add to function helper
@raidenz
raidenz / index.html
Created June 5, 2016 17:00
seo meta
<!DOCTYPE html>
<HTML dir='ltr'>
<head>
<!-- cache -->
<meta content='public' http-equiv='Cache-control'/>
<meta content='private' http-equiv='Cache-control'/>
<meta content='no-cache' http-equiv='Cache-control'/>
<meta content='no-store' http-equiv='Cache-control'/>
<!-- cache -->
<include expiration='7d' path='*.css'></include>
@raidenz
raidenz / server.js
Created June 21, 2016 10:04
node witout framework
// https://developer.mozilla.org/en-US/docs/Node_server_without_framework
var http = require('http');
var fs = require('fs');
var path = require('path');
http.createServer(function (request, response) {
console.log('request starting...');
var filePath = '.' + request.url;
if (filePath == './')
@raidenz
raidenz / pusher.js
Last active June 24, 2016 15:27
Pusher basic
var socketId = null;
var channel = null;
Pusher.logToConsole = true;
pusher = new Pusher('xxx', {
cluster: 'ap1',
authEndpoint: '/pusher_auth.php', //custom auth file
encrypted: false
});
// channel = pusher.subscribe('tomicek-subscribe'); //join the tomicek-subscribe channel
// autentikasi hanya terjadi pada prefix presence-* dan private-*
@raidenz
raidenz / Car.php
Created August 25, 2016 15:42 — forked from jgrossi/Car.php
How to use Eloquent (from Laravel) inside Wordpress
<?php // File location: /wp-content/themes/my-theme/src/Models/
namespace App\Models;
use Illuminate\Database\Eloquent\Model as Eloquent;
class Car extends Eloquent
{
protected $table = 'cars';
protected $primaryId = 'id';
@raidenz
raidenz / sidebarscroll.js
Created September 23, 2016 03:07
simple sidebar scroll dengan margin
$sidebar = $("#sidebar-id");
$window = $(window);
var sidebarOffset = $sidebar.offset();
$window.scroll(function () {
if($window.width() > 766){
if ($window.scrollTop() > sidebarOffset.top) {
$sidebar.stop().animate({
marginTop: $window.scrollTop() - sidebarOffset.top + 20
});
@raidenz
raidenz / ion-tabs-swipable.js
Created October 31, 2016 03:35 — forked from taivo/ion-tabs-swipable.js
Swipe navigation for ion-tabs (for ionic framework v 1.0.0)
angular.module('yourModule')
.directive('tabsSwipable', ['$ionicGesture', function($ionicGesture){
//
// make ionTabs swipable. leftswipe -> nextTab, rightswipe -> prevTab
// Usage: just add this as an attribute in the ionTabs tag
// <ion-tabs tabs-swipable> ... </ion-tabs>
//
return {
restrict: 'A',
require: 'ionTabs',
<?php
/* Thumbnail upscale
** source
** http://alxmedia.se/code/2013/10/thumbnail-upscale-correct-crop-in-wordpress/
** ------------------------------------ */
function alx_thumbnail_upscale( $default, $orig_w, $orig_h, $new_w, $new_h, $crop ){
if ( !$crop ) return null; // let the wordpress default function handle this
$aspect_ratio = $orig_w / $orig_h;