Skip to content

Instantly share code, notes, and snippets.

View xrsrke's full-sized avatar
🎯
focus

XλRI-U5 xrsrke

🎯
focus
View GitHub Profile
@jboner
jboner / latency.txt
Last active June 27, 2024 02:47
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@poom
poom / gist:4073207
Created November 14, 2012 16:41 — forked from supermethod/gist:913394
Convert a PHP array into XML file using SimpleXML
class ArrayToXML
{
/**
* The main function for converting to an XML document.
* Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
* Based on: http://snipplr.com/view/3491/convert-php-array-to-xml-or-simple-xml-object-if-you-wish/
*
* @param array $data
* @param string $rootNodeName - what you want the root node to be - defaultsto data.
* @param SimpleXMLElement $xml - should only be used recursively
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@irazasyed
irazasyed / FBFeedShare.md
Last active February 12, 2018 13:05
Facebook Dialog feed share example with all the properties and using YouTube App!

Learn more about Sharing Best Practices for better understanding.

V1: This version has properties but the output would be with numeric keys, Example (Google, Bing and Yahoo are the Hyperlinks/Clickable):

1: Google
2: Bing
3: Yahoo
@nadar
nadar / PostMessageToSlackChannel.php
Last active June 5, 2024 17:05
Post a message to a slack channel with PHP
<?php
/**
* Send a Message to a Slack Channel.
*
* In order to get the API Token visit:
*
* 1.) Create an APP -> https://api.slack.com/apps/
* 2.) See menu entry "Install App"
* 3.) Use the "Bot User OAuth Token"
@jeffochoa
jeffochoa / Response.php
Last active May 22, 2024 04:06
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@KaiCMueller
KaiCMueller / array_merge_recursive_distinct.php
Created November 9, 2017 10:12
Merging two multi dimensional arrays, overwriting existing values
<?php
/**
* array_merge_recursive does indeed merge arrays, but it converts values with duplicate
* keys to arrays rather than overwriting the value in the first array with the duplicate
* value in the second array, as array_merge does. I.e., with array_merge_recursive,
* this happens (documented behavior):
*
* array_merge_recursive(array('key' => 'org value'), array('key' => 'new value'));
* => array('key' => array('org value', 'new value'));
@simonw
simonw / how-to-upgrade-heroku-postgresql.md
Last active April 29, 2024 05:07
How to upgrade a Heroku PostgreSQL database to a new plan

How to upgrade a Heroku PostgreSQL database to a new plan

I started a project on a Hobby Dev plan (free, limit 10,000 rows), and then later needed to upgrade it to Hobby Basic ($9/month, limit 10,000,000 rows).

After assigning the new database, I had two databases attached to the application. They looked something like this:

  • HEROKU_POSTGRESQL_OLIVE (postgresql-dimensional-3321) Old, free-tier (Hobby Dev) database
@andersevenrud
andersevenrud / TODO.md
Last active January 5, 2019 23:37
OS.js v3 TODO list

OS.js v3 has been released

This is the "general" list of tasks for OS.js v3 development. I'm just adding things here as I go or things pop into mind. So if you see anything interesting and you want to pitch in, that'd be much appreciated.

See the following repositories for issues/todos that are not included here: