Skip to content

Instantly share code, notes, and snippets.

View Jalalhejazi's full-sized avatar
💭
Automation | Teaching | Inspiring | Sharing

Jalal Hejazi Jalalhejazi

💭
Automation | Teaching | Inspiring | Sharing
  • Demant Enterprise
  • Denmark
View GitHub Profile
@Jalalhejazi
Jalalhejazi / YQL json
Last active January 15, 2016 19:10 — forked from ydn/gist:320165
JSON: YQL CONVERT TO JSON FORMAT
<!-- Use YQL to convert XML to JSON in your sleep -->
<!-- Introduced in YDN blog post: http://developer.yahoo.net/blog/archives/2010/03/yql_code_samples_yql_is_easy_to_use.html -->
<script src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"></script>
<ul>UN Headlines:</ul>
<script>
var Y = new YUI();
function handleResponse ( json ) {
var items = json.query.results.item;
for ( var i = 0; i < items.length; i++ ) {
@Jalalhejazi
Jalalhejazi / Module1.js
Created March 31, 2013 01:13 — forked from fatihacet/Module1.js
JavaScript: module loading for seperate pages
var Module1 = function() {
this.message = 'Hello World from Module1';
this.init();
};
Module1.prototype.init = function() {
console.log(this.message);
};
@Jalalhejazi
Jalalhejazi / launch_sublime_from_terminal.markdown
Created April 3, 2013 12:08 — forked from artero/launch_sublime_from_terminal.markdown
Sublime Text: Launch Sublime from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@Jalalhejazi
Jalalhejazi / basic-static-http-server.js
Created April 27, 2013 18:06 — forked from saary/basic-static-http-server.js
node: basic static http server.
var http = require('http');
var url = require('url');
var mime = require('mime');
var fs = require('fs');
var port = process.env.PORT || 40000;
http.createServer(function(req, res) {
var u = url.parse(req.url);
var filename = __dirname + '/static' + u.pathname;
fs.exists(filename, function(exists) {
@Jalalhejazi
Jalalhejazi / uninstall.sh
Last active December 17, 2015 00:49 — forked from distracteddev/uninstall.sh
node: UnInstall node.js on MacOX to clean older version of node..
try to use nodebrew:
nodebrew version Manager>
https://github.com/Jalalhejazi/nodebrew
UnInstall node older versions:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do  sudo rm /usr/local/${f}; done
@Jalalhejazi
Jalalhejazi / gist:5594650
Last active December 17, 2015 10:28 — forked from mikeyk/gist:1329319
redis: python Script performance of hashing
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@Jalalhejazi
Jalalhejazi / AuthorService.cs
Created May 22, 2013 07:10 — forked from mythz/AuthorService.cs
ServiceStack: AuthorService as REST Interface
/*
With no other C# or config other than OrmLite DB config in AppHost below - this web service provides all the screenshots attached, out-of-the-box, for free.
container.Register<IDbConnectionFactory>(
new OrmLiteConnectionFactory(ConfigUtils.GetConnectionString("AppDb"), //ConnectionString in Web.Config
SqlServerOrmLiteDialectProvider.Instance) {
ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current) });
-- Code-first Simplicity at Great Speed - http://www.servicestack.net/benchmarks/
@Jalalhejazi
Jalalhejazi / jQuery.loadScript
Created September 15, 2013 20:10 — forked from bradvin/jQuery.loadScript
jQuery.loadScript
jQuery.loadScript = function (url, arg1, arg2) {
var cache = false, callback = null;
//arg1 and arg2 can be interchangable as either the callback function or the cache bool
if ($.isFunction(arg1)){
callback = arg1;
cache = arg2 || cache;
} else {
cache = arg1 || cache;
callback = arg2 || callback;
}
/* Tutorial example from:
* Your First ASP.NET Web API (C#):
* http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api
*/
namespace HelloWebAPI.Controllers
{
public class ProductsController : ApiController
{
Product[] products = new Product[]
{
@Jalalhejazi
Jalalhejazi / gist:7427251
Last active December 28, 2015 02:19
Sublime Text - Useful Shortcuts (PC)

Sublime Text – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after