Skip to content

Instantly share code, notes, and snippets.

View sagarjethi's full-sized avatar
🏠
Working from home

sagar jethi sagarjethi

🏠
Working from home
View GitHub Profile
@weakish
weakish / android-app-list.markdown
Created July 5, 2011 15:04
my android app list

My Android Apps list

Where to find applications

  • [F-Droid][]
  • a [list][] on wikipedia
  • googlecode, github, etc
@nikic
nikic / objects_arrays.md
Last active April 12, 2024 17:05
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

@blackfalcon
blackfalcon / git-feature-workflow.md
Last active April 13, 2024 07:33
Git basics - a general workflow

Git-workflow vs feature branching

When working with Git, there are two prevailing workflows are Git workflow and feature branches. IMHO, being more of a subscriber to continuous integration, I feel that the feature branch workflow is better suited, and the focus of this article.

If you are new to Git and Git-workflows, I suggest reading the atlassian.com Git Workflow article in addition to this as there is more detail there than presented here.

I admit, using Bash in the command line with the standard configuration leaves a bit to be desired when it comes to awareness of state. A tool that I suggest using follows these instructions on setting up GIT Bash autocompletion. This tool will assist you to better visualize the state of a branc

@adamcapriola
adamcapriola / page_discourse-sso.php
Last active March 24, 2020 14:21
WordPress Page Template for SSO with Discourse
<?php
/**
* Template Name: Discourse SSO
* Author: Adam Capriola
* Version: 1.1
* Author URI: https://meta.discourse.org/users/AdamCapriola/activity
* Adapted From: https://github.com/ArmedGuy/discourse_sso_php
* Uses: https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045
*
*/
@brandonmwest
brandonmwest / example.cs
Last active January 16, 2024 15:52
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));
@aamnah
aamnah / lamp.sh
Last active February 19, 2024 11:51
Bash script to install Apache, MySQL and PHP as well as PHPMyAdmin and some tweaks. For Debian and Ubuntu. To run, copy the script to the server and run ``bash lamp.sh``
#!/bin/sh
#######################################
# Bash script to install an AMP stack and PHPMyAdmin plus tweaks. For Debian based systems.
# Written by @AamnahAkram from http://aamnah.com
# In case of any errors (e.g. MySQL) just re-run the script. Nothing will be re-installed except for the packages with errors.
#######################################
#COLORS
var n_source = eth.compile.solidity("contract naive { mapping (bytes32 => int) intRegister; function registerInt(bytes32 key, int value) external { intRegister[key] = value; } function returnInt(bytes32 key, int value) internal { msg.sender.call(bytes4(sha3(\"registerInt(bytes32,int)\")), key, value); } function makeKey(address callee, bytes32 funcName, bytes32 argsHash) internal returns (bytes32 key) { return sha3(block.blockhash(block.number), callee, funcName, argsHash); } } contract Sub is naive { function add(bytes32 key, int a, int b) external returns (int sum) { sum = a + b; returnInt(key, sum); return sum; } } contract Master is naive { function delegated(address to, int a, int b) external returns (int sum) { bytes32 argsHash = sha3(a, b); bytes32 key = makeKey(to, \"add\", argsHash); to.call(bytes4(sha3(\"add(bytes32,int,int)\")), key, a, b); return intRegister[key]; } }");
var n_master = n_source.Master;
var n_masterContract = eth.contract(n_master.info.abiDefinition);
var m_addr = "0x45b9bb86b94ae

Basic

  1. Index -> Database
  2. Type -> Table
  3. Field -> Column
localhost:9200/[index]/[type]
@frozeman
frozeman / token.md
Last active October 23, 2022 00:47
Token proposal

This is outdated: The ERC-20 is here: ethereum/EIPs#20

Token

Methods

totalSupply