Skip to content

Instantly share code, notes, and snippets.

View wesamly's full-sized avatar

Wesam Alalem wesamly

View GitHub Profile
@tonysneed
tonysneed / Mac OS X: Open in Visual Studio Code
Last active March 27, 2024 10:02
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"
@graste
graste / strace.md
Last active May 31, 2024 09:06
strace process for network and memory and other syscalls

File activity

strace -e trace=file -fp PID (file) or strace -e trace=desc -fp PID (file descriptors)

Common calls:

  • access
  • close – close file handle
  • fchmod – change file permissions
  • fchown – change file ownership
@stephywells
stephywells / formidable-mediavault.php
Created July 25, 2015 21:59
Send Formidable uploads to Media Value
<?php
/**
* Plugin Name: Formidable MediaVault
* Plugin URI: https://www.formidablepro.com
* Description: This plugin will allow you to use
* Version: 1.0.0
* Author: Strategy11
* Author URI: http://strategy11.com
* License: GPL2
*/
@pietromalerba
pietromalerba / woocommerce-my-account.php
Last active July 13, 2022 18:34 — forked from SiR-DanieL/functions.php
Add custom fields to Woocommerce My Account
// Add VAT and SSN fields in billing address display
add_filter( 'woocommerce_order_formatted_billing_address', 'custom_add_vat_ssn_formatted_billing_address', 10, 2 );
function custom_add_vat_ssn_formatted_billing_address( $fields, $order ) {
$fields['vat'] = $order->billing_vat;
$fields['ssn'] = $order->billing_ssn;
return $fields;
}
add_filter( 'woocommerce_my_account_my_address_formatted_address', 'custom_my_account_my_address_formatted_address', 10, 3 );
@utoxin
utoxin / nslookup.php
Last active October 29, 2017 08:06
Recursive Authoritative Nameserver Lookup in PHP
<?php
class NSLookup {
private $root_servers = array(
'a.root-servers.net.',
'b.root-servers.net.',
'c.root-servers.net.',
'd.root-servers.net.',
'e.root-servers.net.',
'f.root-servers.net.',
'g.root-servers.net.',
@eddmann
eddmann / SecureSessionHandler.php
Created April 9, 2014 12:18
Secure session handler implementation.
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;
@ChrisLTD
ChrisLTD / google-maps-example.html
Created July 14, 2013 00:27
Google Maps API V3 map w/ multiple markers, info boxes and auto center
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Google Maps Multiple Markers</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.1.min.js"></script>
</head>
<body>
<div id="map" style="width: 500px; height: 400px;"></div>
@saniko
saniko / app.js file
Created October 11, 2012 16:59
a very simple bootstrap boilerplate for building backbone.marionette based on require.js
define([
'jquery',
'underscore',
'backbone',
'marionette',
'handlebars',
'text!templates/app_view.html',
'modules/mainMenuView/mainMenuView',
@daveaugustine
daveaugustine / Inside_your_router.coffee
Created February 8, 2012 18:33
Super simple Google Analytics page tracking with backbone
initialize: ->
@bind 'all', @_trackPageview
_trackPageview: ->
url = Backbone.history.getFragment()
_gaq.push(['_trackPageview', "/#{url}"])