Skip to content
View Countries
"countries" => [
[
"code" => "AD",
"name" => "Andorra",
"continent_code" => "EU"
],
[
"code" => "AE",
"name" => "United Arab Emirates",
"continent_code" => "AS"
View css-property-order.md

CSS Property Order

My personal CSS Property order is currently as follows.

content and other esoteric stuff
display
flex
  flex-direction
  align-items
View IPUtil.java
public class IPUtil {
public static String getIPAddress(HttpServletRequest request) {
String ip = request.getHeader("X-Real-IP");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("x-forwarded-for");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
View FindMinBinarySearch.js
function findMinBinarySearch(array) {
var left = 0, // index of first element
right = array.length - 1, // index of last element.
mid, // midpoint
count = 0;
while (array[left] > array[right]) {
count++;
mid = ~~((left + right) / 2); // math.floor of the midpoint
if (array[mid] > array[right]) {
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View english_spanish2.rb
v = Tropo::Generator.parse request.env["rack.input"].read
actions = v['result']['actions']
if(actions[:interpretation])
message = "Gracias por llamar a 1 8 4 4 llamalo"
else
message = "Thank you for calling 1 8 4 4 speak it. " # + actions['concept']
end
t = Tropo::Generator.new
t.say message
render :json => t.response
View per_instance_memoization.py
from functools import lru_cache
import time
def per_instance(factory, *factory_args, **factory_kwargs):
"""Applies the given decorator on a per-instance basis."""
def lazy_binder(method):
"""Replaces the method just in time when it is first invoked."""
View Torrent Manager
XAML with Bindings
<DataGrid ItemsSource="{Binding Torrents}" AutoGenerateColumns="False" HorizontalAlignment="Stretch">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Torrent Name" IsReadOnly="True" Width="300" CanUserSort="True" SortMemberPath="Name">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
View gist:b09e789d61eb4c760ae89c7d207d405a
<div style="margin:50px auto 50px auto;">
<div style="margin:auto;width:750px;height:300px;">
<div style="float:left;margin:auto;width:750px;height:300px;background:#fff;">
<div style="float:left;margin:10px auto auto 10px;width:733px;height:30px;background:#000;">
<div style="float:right;margin:3px 5px auto auto;font-size:15px;font-family:tahoma;color:#fff;text-transform:uppercase;letter-spacing:-1px;"><strong>black&amp;white</strong></div>
</div>
<div style="float:left;margin:5px auto auto 10px;width:199px;height:244px;background:#000;border:solid 1px #000;overflow:hidden;">
<div style="width:219px;height:244px;float:left;margin:auto;overflow:auto;">
<div style="width:199px;">
Something went wrong with that request. Please try again.