Skip to content

Instantly share code, notes, and snippets.

@jeffsebring
jeffsebring / wordpress_json
Created December 24, 2011 01:20
WordPress JSON Parser Example
<?php
/**
* JSON Response
* Get json data from url and decode.
*/
# Get the WordPress json parser
if ( ! function_exists( 'json_parser' ) ) :
@troygoode
troygoode / Example-1.cs
Created November 3, 2012 05:36
MVC: Action Filter for Handling Errors
public void Product( int? id ) {
if( id == null )
throw new ArgumentNullException( "No Product ID" );
RenderView( "DisplayProduct", GetProduct(id.Value) );
}
@ifrahim
ifrahim / CreateIISSite
Created February 26, 2014 15:31
Create IIS Site using Powershell
# The following code will create an IIS site and it associated Application Pool.
# Please note that you will be required to run PS with elevated permissions.
# Visit http://ifrahimblog.wordpress.com/2014/02/26/run-powershell-elevated-permissions-import-iis-module/
# set-executionpolicy unrestricted
$SiteFolderPath = "C:\WebSite" # Website Folder
$SiteAppPool = "MyAppPool" # Application Pool Name
$SiteName = "MySite" # IIS Site Name
$SiteHostName = "www.MySite.com" # Host Header
@prantlf
prantlf / logger.js
Last active February 22, 2022 09:56 — forked from rtgibbons/logger.js
Logger Library with winston - Fixed for additional log arguments
var app = require(process.cwd() + '/app');
var winston = require('winston');
var _ = require('lodash');
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'green',
warn: 'yellow',
@DanielSWolf
DanielSWolf / Program.cs
Last active July 30, 2024 15:46
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@thachpham92
thachpham92 / gist:d57b18cf02e3550acdb5
Last active March 1, 2024 17:10
Tất cả các tham số trong WP_Query
// Source: https://gist.github.com/luetkemj/2023628
// Xem hướng dẫn WP_Query toàn tập: http://goo.gl/kRpzTz
<?php
$args = array(
//////Author Parameters - Tham số lấy bài viết theo tác giả
//http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters
'author' => '1,2,3,', //(int) - Các ID tác giả cần lấy bài viết (thêm dấu - vào để loại trừ tác giả, ví dụ: -14, -20)
'author_name' => 'luetkemj', //(string) - Lấy bài viết dựa theo tên nick name của tác giả
'author__in' => array( 2, 6 ), //(array) - Lấy bài dựa theo ID của tác giả
public class DataTableParameters
{
public List<DataTableColumn> Columns { get; set; }
public int Draw { get; set; }
public int Length { get; set; }
public List<DataOrder> Order { get; set; }
public Search Search { get; set; }
public int Start { get; set; }
@wojteklu
wojteklu / clean_code.md
Last active July 31, 2024 04:48
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@erogol
erogol / tts_example.ipynb
Last active July 5, 2024 04:27
TTS_example.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.