Skip to content

Instantly share code, notes, and snippets.

View raidenz's full-sized avatar

raidenz raidenz

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / isMobile.js
Created March 9, 2016 01:46
detect mobile device
// https://www.mattcromwell.com/detecting-mobile-devices-javascript/
var isMobile = {
Android: function() { return navigator.userAgent.match(/Android/i); },
BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); },
iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); },
Opera: function() { return navigator.userAgent.match(/Opera Mini/i); },
Windows: function() { return navigator.userAgent.match(/IEMobile/i); },
any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } };
@raidenz
raidenz / fikrirasyid-gruntfile.js
Last active November 29, 2016 17:09
wp grunt fikrirasyid
'use strict';
module.exports = function(grunt){
// load all tasks
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
makepot: {
target: {
@raidenz
raidenz / php
Last active January 22, 2016 04:00
cygwin fix php
#!/bin/bash
# fix wp-cli di cygwin
# save as php
# jika muncul error '\r' gunakan dos2unix php
# masukkan wp dan php ke /usr/local/bin
# chmod +x php
# chmod +x wp
# e.g. php="/cygdrive/c/Program Files (x86)/php/php.exe"
php="/cygdrive/c/xampp/php/php.exe"
@raidenz
raidenz / gist:d8cefbe2cb472c9b30b2
Created November 26, 2015 02:24 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter