Skip to content

Instantly share code, notes, and snippets.

View hernamesbarbara's full-sized avatar

austin hernamesbarbara

View GitHub Profile
@hernamesbarbara
hernamesbarbara / select_star_in_salesforce_apex.cls
Created November 20, 2014 22:47
Salesforce won't let you select star (SELECT *). This is a workaround where you generate the SOQL manually by inspecting the schema of the table.
Map<String, Schema.SObjectField> field_objmap = schema.SObjectType.Opportunity.fields.getMap();
List<Schema.SObjectField> field_objmap_values = field_objmap.values();
List<String> field_names_list = new List<String>();
for(Schema.SObjectField s : field_objmap_values) {
String field_label = String.valueOf(s.getDescribe().getLabel()); // Perhaps store this in another map
String field_name = String.valueOf(s.getDescribe().getName());
String field_type = String.valueOf(s.getDescribe().getType());
#!/usr/bin/osascript
(* subroutine to bring an application to front.
you could invoke it from an alias in your
~/.bash_profile, another script or an alfred workflow
*)
property default_app : ""
on bring_to_front(app_name)
set res to false
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
sample = """user_id,website 1 name,website 1 value,website 2 name,website 2 value,website 3 name,website 3 value
'000001,linkedin,https://linkedin.com/245563,github,https://github.com/926850,,
'000002,facebook,https://facebook.com/976099,,,,
'000003,twitter,https://twitter.com/612711,,,linkedin,https://linkedin.com/840609
'000004,github,https://github.com/220993,blog,https://blog.com/201188,linkedin,https://linkedin.com/479351
'000005,,,twitter,https://twitter.com/897816,,
@hernamesbarbara
hernamesbarbara / README.md
Created June 8, 2014 19:10
A numpy implementation ~5× faster than using itertools.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/bash
echo COCKTAIL GLASS > drinks.txt
echo -e "\xf0\x9f\x8d\xb8" >> drinks.txt
echo TROPICAL DRINK >> drinks.txt
echo -e "\xf0\x9f\x8d\xb9" >> drinks.txt
echo BEER MUG >> drinks.txt
echo -e "\xf0\x9f\x8d\xba" >> drinks.txt
@hernamesbarbara
hernamesbarbara / lm.js
Last active August 29, 2015 13:56
simple linear regression in javascript
var _ = require('underscore');
function simple_linear_regression (x, y) {
var sum_x = 0
, sum_y = 0
, sum_xy = 0
, sum_xx = 0
, cnt = 0
, nrow = x.length
, m = null
[
{
"keys": [
"alt+minus"
],
"command": "insert",
"args": {
"characters": " <- "
},
"context": [
{
"default_encoding": "UTF-8",
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"font_face": "Consolas",
"font_size": 13,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages": [
"Vintage"